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)۔
It is narrated from Ka'b bin Asim Al-Ash'ari (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Fasting during travel is not a good deed."
Hadith Referenceمسند الإمام الشافعي / كتاب الصيام / 624
Hadith Takhrijاخرجه ابن ماجة الصيام، باب ماجاء في الإفطار في السفر (1664) والنسائی، الصيام، باب ما يكره الصيام في السفر (2257) ۔ وصححه ابن خزيمة (2016) ۔ والحاكم : (1/ 433)۔