Whenever the Messenger of Allah ﷺ traveled and wished to perform a voluntary prayer, he would turn his she-camel toward the qiblah, say the takbir, and then pray in whatever direction his mount was facing.
حدثنا مسدد حدثنا ربعي بن عبد الله بن الجارود حدثني عمرو بن أبي الحجاج حدثني الجارود بن أبي سبرة
أن رسول الله ﷺ كان إذا سافر فأراد أن يتطوع استقبل بناقته القبلة فكبر ثم صلى حيث وجهه ركابه
[Its isnad is hasan] Ahmad reported it in 3/203 from the hadith of Rubai bin Abdullah.