It is narrated from Ibn Abbas (may Allah be pleased with him) that he stated: The Messenger of Allah (peace and blessings be upon him) traveled between Makkah and Madinah in a state of security; he did not fear anyone except Allah Almighty, and he would perform two rak‘ahs of prayer.
Hadith Referenceمسند الإمام الشافعي / كتاب الصلاة / 341
Hadith Takhrijأخرجه الترمذي: أبواب السفر، باب ما جاء في التقصير في السفر: 547 ۔ وقال حسن صحيح. والنسائي: تقصير الصلاة: 1436.