It is narrated from Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) used to perform (optional) prayers while traveling on his mount, facing in whichever direction the mount was headed. Abdullah bin Dinar (may Allah have mercy on him) says that Abdullah bin Umar (may Allah be pleased with them both) used to do the same.
Hadith Referenceالسنن المأثورة / باب ما جاء في الصلاة على الراحلة / 80