The Messenger of Allah ﷺ used to perform voluntary prayers while riding his she-camel during travel, facing whatever direction it was heading rather than the qiblah.
حدثنا عبد الصمد بن عبد الوارث حدثنا بكار بن ماهان حدثنا أنس بن سيرين
أن رسول الله ﷺ كان يصلي على ناقته تطوعا في السفر لغير القبلة
Its isnad is sahih. Bakkar bin Mahan was not narrated by Ahmad, and Bukhari mentioned him in Tarikh al-Kabir 1/2/121, mentioning this account from his narration and remaining silent about him. Ibn Hibban mentioned him in Thiqat 6/108.The hadith was narrated in similar wording by Bukhari 1/110 in "Prayer, Facing Other Than the Qibla," from Jabir, by Muslim 1/486 no. 700 in "Travelers" with the same wording, by Abu Dawud 1/184 no. 692 in "Prayer, Voluntary Prayer on a Mount," by Tirmidhi 2/183 no. 352, who said, hasan sahih, by Nasai 1/244 no. 492, by Darimi 1/384 no. 1412, and by Malik 1/157 no. 41, all of them from Ibn Umar.