It is narrated from Sayyiduna Anas bin Malik (may Allah be pleased with him): "When the Messenger of Allah (peace and blessings be upon him) was on a journey and wished to offer a voluntary prayer, he would (at the start) face the qiblah and say the opening takbir, and then he (peace and blessings be upon him) would pray in whatever direction his mount faced." Amr relates: I mentioned this hadith to Matar al-Warraq, and he said (in explanation): "Whichever direction it happens to face."
Abu Dawud al-Tayalisi recorded it.