عن أبي موسى الأشعري رضي الله عنه قال: قال رسول الله صلى الله عليه وسلم : «إذا مَرِض العَبد أو سافر كُتِب له مثلُ ما كان يعمل مقيمًا صحيحًا».
[صحيح] - [رواه البخاري]
Abu Mūsa al-Ash‘ari (may Allah be pleased with him) reported: The Messenger of Allah (may Allah’s peace and blessings be upon him) said: "If a person falls ill or travels, he shall be credited with whatever good deeds he used to perform while at home and in good health."
Sahih/Authentic. - [Al-Bukhari]
If a person habitually performs some pious act when he is healthy or has free time, and then he becomes sick and therefore unable to perform this same deed, Allah, the Almighty, will record for him the reward in full, as if he has actually done it. The same holds true if a person is prevented from doing this usual act by a journey or anything else, like menses.