"The messenger of Allah (peace be upon him) used to pray atop his mount while travelling, facing whatever direction it was facing." (One of the narrators) Malik said: "Abdullah bin Dinar said: and Ibn Umar used to do likewise".
كَانَ رَسُولُ اللَّهِ ﷺ يُصَلِّي عَلَى رَاحِلَتِهِ فِي السَّفَرِ حَيْثُمَا تَوَجَّهَتْ بِهِ قَالَ مَالِكٌ قَالَ عَبْدُ اللَّهِ بْنُ دِينَارٍ وَكَانَ ابْنُ عُمَرَ يَفْعَلُ ذَلِكَ