«كان يصلي على راحلته حيثما توجهت به فإذا أراد أن يصلي المكتوبة نزل فاستقبل القبلة»
It was the practice of the Prophet (peace and blessings be upon him):
"He (peace and blessings be upon him) would offer voluntary prayer on his mount, whichever direction it faced, but when he intended to offer an obligatory prayer, he would dismount and face the Qiblah."
Hadith Referenceصحیح الجامع الصغیر / حرف الكاف / 4965