Berachos4: 5
הָיָה רוֹכֵב עַל הַחֲמוֹר — יֵרֵד. וְאִם אֵינוֹ יָכוֹל לֵירֵד — יַחֲזִיר אֶת פָּנָיו. וְאִם אֵינוֹ יָכוֹל לְהַחֲזִיר אֶת פָּנָיו — יְכַוֵּן אֶת לִבּוֹ כְּנֶגֶד בֵּית קֹדֶשׁ הַקֳּדָשִׁים.
[If] one was riding on a donkey, he should dismount [to pray]. But if he is not able to dismount, he should turn his face [and pray]. And if he is unable to turn his face, he should concentrate his thoughts toward the Chamber of the Holy of Holies [while pray-ing].