The Messenger of Allah ﷺ said, "When a servant falls ill or travels, the same reward is recorded for him as he would earn when healthy and at home."
قال رسول الله ﷺ: إذا مرض العبد أو سافر، كتب له مثل ما كان يعمل مقيما صحيحا.
Bukhari related it in the Book of Jihad and Military Expeditions (2996), from Matar bin Fadl, who said, Yazid bin Harun told us, Awwam told us, Ibrahim Abu Ismail Saksaki told us, saying, I heard Abu Burda say, when he and Yazid bin Abu Kabsha traveled together on a journey, Yazid used to fast while traveling, so Abu Burda said to him, "I heard Abu Musa say several times..." and he related the hadith.