From Sahih Muslim (Hadith 2612):
Jabir b. 'Abdullah (Allah be pleased with both of them) reported that in the course of a journey Allah's Messenger (ﷺ) saw a man, people crowding around him and providing him a shade. Upon this he (the Holy Prophet) said:What is the matter with him? They said: He is a person observing fast. Whereupon the Messenger of Allah (ﷺ) said: It is no righteousness that you fast on journey
Reference: Muslim 2612