The Messenger of Allah ﷺ used to perform voluntary prayers on his mount, facing whatever direction it happened to be heading, and he would also pray witr on it. However, he did not perform the obligatory prayers on it.
كان رسول الله ﷺ يسبح على الراحلة قبل أي وجه توجه، ويوتر عليها، غير أنه لا يصلي عليها المكتوبة.
Muslim narrated it in the Book of the Prayer of Travelers (39/700) through the hadith of Ibn Wahb, "Yunus informed me, from Ibn Shihab, from Salim bin Abdullah, from his father," and then mentioned it. Bukhari cited it as a suspended report in the Book of Shortening the Prayer (1098), saying, "Layth said, Yunus narrated to me," with the same chain, and in it Salim said, "Abdullah used to pray on his mount at night while traveling, not concerning himself with which direction he was facing." Abdullah said, and then mentioned it.Bukhari's statement, "Layth said," could either be a suspended report, or it could be connected to the chain mentioned earlier through Yahya bin Bukayr, where he said, "Layth narrated to us, from Aqeel, from Ibn Shihab, from Abdullah bin Amir bin Rabia, from his father," which was mentioned earlier at the beginning of the chapter.