Ibn ‘Umar said that on a journey God’s Messenger would pray on his riding beast in whatever direction it turned, making a sign with his head* in prayer during the night, but not in the obligatory prayers; and he would observe a witr on his riding beast.
*To indicate the bowing and the prostration.
(Bukhari and Muslim.)