You will get the reward if you always had the habit of practicing such worship acts, and the only reason you did not do it was travel or sickness.
Narrated Ibrahim Abu Isma’il As-Saksaki:
I heard Abu Burda, who accompanied Yazid bin Abi Kabsha on a journey. Yazid used to observe fasting on journeys. Abu Burda said to him, “I heard Abu Musa several times saying that Allah’s Apostle said, ‘When a slave falls ill or travels, then he will get a reward similar to that he gets for good deeds practiced at home when in good health.” Reference : Sahih al-Bukhari 2996