I heard the Messenger of Allah ﷺ say, "If a plague occurs in a land where you are, do not flee from it, and if it occurs in a land you are not in, do not enter it."
سمعت رس رسول الله ﷺ يقول: إذا كان الطاعون بأرض وأنتم بها، فلا تفروا منها، وإذا كان بأرض فلا تهبطوا عليها.
Tahawi related it in Sharh Maani (6999) from Muhammad bin Khuzayma, who said, Musaddad told us, who said, Yahya told us, from Hisham, from Yahya bin Abu Kathir, from Hadrami, from Saeed bin Musayab, from Saad bin Abu Waqqas, and he mentioned it.Its chain is hasan because of Hadrami, who is Ibn Lahiq, for he is hasan al-hadith.Ahmad related it (1554) through another route from Yahya bin Abu Kathir with his chain, with the addition of "bad omens," and it has been dealt with in its proper place.The meaning of the hadith is that whoever is in a land where plague has struck is forbidden from leaving it, because if he left it and remained safe, he would say, "If I had stayed in that land, what befell its people would have befallen me too." Likewise, one is forbidden from entering a land where plague has struck, for if he entered it and was afflicted, he would say, "Had I not come here, this affliction would not have befallen me." All of this contradicts faith in divine decree, and that is why this ruling came about.