The Messenger of Allah ﷺ used to pray upon his mount while traveling, in whatever direction it happened to face. Abdullah bin Dinar said that Abdullah bin Umar used to do the same.
و حدثني عن مالك عن عبد الله بن دينار
أن رسول الله ﷺ كان يصلي على راحلته في السفر حيث توجهت به قال عبد الله بن دينار وكان عبد الله بن عمر يفعل ذلك