At night ʿAbdullah bin ʿUmar used to offer the prayer on the back of his animal during the journey and never cared about the direction he faced. Ibn ʿUmar said, "Messenger of Allah ﷺ used to offer the optional prayer on the back of his Mount facing any direction and also used to pray the witr on it but never offered the compulsory prayer on it."
سَالِمٌ كَانَ عَبْدُ اللَّهِ يُصَلِّي عَلَى دَابَّتِهِ مِنَ اللَّيْلِ وَهْوَ مُسَافِرٌ مَا يُبَالِي حَيْثُ مَا كَانَ وَجْهُهُ قَالَ ابْنُ عُمَرَ وَكَانَ رَسُولُ اللَّهِ ﷺ يُسَبِّحُ عَلَى الرَّاحِلَةِ قِبَلَ أَىِّ وَجْهٍ تَوَجَّهَ وَيُوتِرُ عَلَيْهَا غَيْرَ أَنَّهُ لاَ يُصَلِّي عَلَيْهَا الْمَكْتُوبَةَ