The Messenger of Allah ﷺ traveled during Ramadan and fasted until he reached Usfan. Then he called for a vessel of water and drank from it during the day so that the people could see him, and he continued not fasting until he arrived in Mecca.Ibn Abbas used to say, "The Messenger of Allah ﷺ both fasted and broke his fast while traveling, so whoever wishes may fast, and whoever wishes may break his fast."
حدثنا علي بن عبد الله حدثنا جرير عن منصور عن مجاهد عن طاوس
سافر رسول الله ﷺ في رمضان فصام حتى بلغ عسفان ثم دعا بإناء من ماء فشرب نهارا ليريه الناس فأفطر حتى قدم مكة قال وكان ابن عباس يقول صام رسول الله ﷺ في السفر وأفطر فمن شاء صام ومن شاء أفطر