Abu Dawud Book 8, Hadith Number 2593.
Narated By Abdullah ibn Umar : When the Apostle of Allah (PBUH) sat on his camel to go out on a journey, he said: “Allah is Most Great” three times. Then he said: “Glory be to Him Who has made subservient to us, for we had not the strength for it, and to our Lord do we return. O Allah, we ask Thee in this journey of ours, uprightness, piety and such deeds as are pleasing to Thee. O Allah, make easy for us this journey of ours and make its length short for us. O Allah, Thou art the Companion in the journey, and the One Who looks after the family and property in our absence.” When he returned, he said these words adding: “Returning, repentant, serving and praising our Lord.” The Prophet (PBUH) and his armies said: “Allah is Most Great” when they went up to high ground; and when armies said: “Allah is most Great” when they went up to high ground; and when they descended, they said: “Glory be to Allah.” So the prayer was patterned on that.