I heard the Prophet ﷺ many times say: When a servant of Allah is accustomed to do a good work, then becomes ill or goes on journey, what was accustomed to do when he was well and staying at home will be recorded for him. (Using translation from Abū Dāʾūd 3091)
"إذا كانَ العَبْدُ يعملُ عملًا صالحًا فشغَلهُ عنه مرضٌ أو سَفرٌ كُتِبَ له كصَالِح ما كانَ يعْملُ وهو صحيحٌ مُقيمٌ".