(4) باب جَوَازِ صَلاَةِ النَّافِلَةِ عَلَى الدَّابَّةِ فِي السَّفَرِ حَيْثُ تَوَجَّهَتْ
Anas b. Sirin reported:
We met Anas b. Malik as he came to Syria at a place known as 'Ain-al-Tamar and saw him observing prayer on the back of his donkey with his face turned in that direction. (Hammam one of the narrators) pointed towards the left of Qibla, so I said to him: I find you observing prayer towards the side other than that of Qibla. Upon this he said: Had I not seen the Messenger of Allah (ﷺ) doing like this, I would not have done so at all.
Reference: Sahih Muslim 702
In-book reference: Book 6, Hadith 51
USC-MSA web (English) reference(deprecated numbering scheme): Book 4, Hadith 1507