Abdullah bin Umar reported,

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 the witr on it, but he would not pray the obligatory prayers while mounted.

Muslim 1618

Sahih

و حدثني حرملة بن يحيى أخبرنا ابن وهب أخبرني يونس عن ابن شهاب

عن سالم بن عبد الله عن أبيه قال

كان رسول الله ﷺ يسبح على الراحلة قبل أي وجه توجه ويوتر عليها غير أنه لا يصلي عليها المكتوبة

مسلم 1618صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Travelers' prayer and its shortening
Chapter
Permissibility of praying voluntary prayers on a mount while traveling, whichever direction it faces
Numbering
Darussalam 1618
Muslim 1618