While travelling the Messenger of Allah ﷺ would pray voluntary prayer on his riding beast in whatever direction it turned; and he would observe witr prayer, but he did not offer the obligatory prayers upon it.
كَانَ رَسُولُ اللَّهِ ﷺ يُسَبِّحُ عَلَى الرَّاحِلَةِ أَىَّ وَجْهٍ تَوَجَّهَ وَيُوتِرُ عَلَيْهَا غَيْرَ أَنَّهُ لاَ يُصَلِّي الْمَكْتُوبَةَ عَلَيْهَا