Messenger of Allah ﷺ said, "Plague was a means of torture sent on a group of Israelis (or on some people before you). So if you hear of its spread in a land, don't approach it, and if a plague should appear in a land where you are present, then don't leave that land in order to run away from it (i.e. plague).
سَمِعْتَ مِنْ رَسُولِ اللَّهِ ﷺ فِي الطَّاعُونِ فَقَالَ أُسَامَةُ قَالَ رَسُولُ اللَّهِ ﷺ الطَّاعُونُ رِجْسٌ أُرْسِلَ عَلَى طَائِفَةٍ مِنْ بَنِي إِسْرَائِيلَ أَوْ عَلَى مَنْ كَانَ قَبْلَكُمْ فَإِذَا سَمِعْتُمْ بِهِ بِأَرْضٍ فَلاَ تَقْدَمُوا عَلَيْهِ وَإِذَا وَقَعَ بِأَرْضٍ وَأَنْتُمْ بِهَا فَلاَ تَخْرُجُوا فِرَارًا مِنْهُ قَالَ أَبُو النَّضْرِ لاَ يُخْرِجُكُمْ إِلاَّ فِرَارًا مِنْهُ