,

Venturing Out Deprives of Reward-Hadith

The Messenger of Allah (sal Allahu alaihi wa sallam) said: “If a man stays in a plague afflicted city, he makes patience and Allah’s pleasure his policy, and does not run away from there, he believes in the fact that he can receive only that harm which Allah has fixed for him, then such a man gets the reward of a martyr.” [Bukhari]
For the sake of containment of the communicable and dangerous disease of plague, Allah (subhana wa ta’ala) has told people not to come to afflicted areas, and people already in those areas, not to venture out.

When people around a person are suffering and dieing it is difficult to stay put in such a place, and a person thinks of fleeing to save oneself. Allah (subhana wa ta’ala) has offered much reward to the person who, for the sake of Allah’s pleasure, obeys Him and does not go run away once the epidemic has broken out around him, for he will only then spread the disease to other areas.

The person should console himself with the knowledge that only that harm will come to him that was destined to be his share anyway, no matter where he were, and that for his patience he will receive the reward of a martyr (shaheed).