It is narrated from Umm al-Mu'minin Sayyida Aisha (may Allah be pleased with her) that Sayyiduna Hamza bin Amr Aslami (may Allah be pleased with him) said to the Messenger of Allah (peace and blessings be upon him): O Messenger of Allah! I intend to travel, what do you command me? He said: "If you wish, then fast, and if you wish, then do not fast."
Sayyiduna Ibn Abbas (may Allah be pleased with them both) said: When the Messenger of Allah (peace and blessings be upon him) set out (from Madinah) in the year Makkah was conquered, he fasted during the journey and all the people also fasted. When he reached the place of Kadid, he broke his fast and all the people also broke their fast. The companions of the Prophet (may Allah be pleased with them all) would immediately adopt any new action of his.
Sayyiduna Jabir bin Abdullah (may Allah be pleased with them both) mentioned that the Messenger of Allah (peace and blessings be upon him) was on a journey (the expedition of conquest) when he saw a crowd and noticed that people were shading someone. The Prophet (peace be upon him) asked: "What is the matter?" They replied: "He is a fasting person." The Prophet (peace be upon him) said: "Fasting while on a journey is not an act of righteousness (not a good deed)."
It is narrated from Sayyiduna Ka'b bin Asim Ash'ari رضي الله عنه that the Messenger of Allah صلى الله عليه وسلم said: "Fasting during travel is not righteousness."