When the Messenger of Allah ﷺ returned from the expedition of Tabuk and drew near to Madinah, he said, "There are people in Madinah who were with you on every journey you made and every valley you crossed."They asked, "Messenger of Allah, even though they are in Madinah?"He replied, "Even though they are in Madinah. A valid excuse kept them behind."
حدثنا محمد بن المثنى حدثنا ابن أبي عدي عن حميد
لما رجع رسول الله ﷺ من غزوة تبوك فدنا من المدينة قال إن بالمدينة لقوما ما سرتم من مسير ولا قطعتم واديا إلا كانوا معكم فيه قالوا يا رسول الله وهم بالمدينة قال وهم بالمدينة حبسهم العذر
Related by Bukhari, Jihad and Military Expeditions, chapter: One who is prevented from participating in battle by a legitimate excuse, hadith no. 2838, 2839, and hadith no. 4423, through various routes from Humayd, with the same wording, explicitly stating that he heard it directly.