The Messenger of Allah ﷺ used to pray on his mount during travel, in whatever direction it faced.
قال قرأت على عبد الرحمن: مالك وحدثنا إسحاق أخبرنا مالك عن عبد الله بن دينار
كان رسول الله ﷺ يصلي على راحلته في السفر حيثما توجهت به
Its isnad is sahih, and it is in Muwatta 1:165. It is a repeat of 5189, and see 5209.