Jabir bin Abdullah (may Allah be pleased with him) narrates that we were with the Messenger of Allah (ﷺ) during the expedition of Tabuk, and the Messenger of Allah (ﷺ) would travel during the forenoon. Suddenly, he (ﷺ) saw a group of people under the shade of a tree, so he asked: "What is this group?" The people said: There is a fasting person among them whom fasting has put in difficulty (or he said something similar). So the Messenger of Allah (ﷺ) said: "Fasting while traveling is not an act of righteousness."
Hadith Referenceمسند الإمام الشافعي / كتاب الصيام / 623
Hadith Takhrijاخرجه البخاري، الصوم، باب قول النبى صلی اللہ علیہ وسلم لمن ظلل عليه .... الخ (1946) ومسلم، الصيام، باب جواز الصوم والفطر في شهر رمضان للمسافر..... الخ (1115)۔