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). (Using translation from Bukhārī 3473)
سَمِعْتَ مِنْ رَسُولِ اللهِ ﷺ فِي الطَّاعُونِ؟ قَالَ أُسَامَةُ بْنُ زَيْدٍ قَالَ رَسُولُ اللهِ ﷺ «الطَّاعُونُ رِجْزٌ أُرْسِلَ عَلَى طَائِفَةٍ مِنْ بَنِي إِسْرَائِيلَ وَعَلَى مَنْ كَانَ قِبْلَكُمْ فَإِذَا سَمِعْتُمْ بِهِ فَلَا تَدْخُلُوا وَإِذَا وَقَعَ بِأَرْضٍ وَأَنْتُمْ بِهَا فَلَا تَخْرُجُوا فِرَارًا مِنْهُ» قَالَ مَالِكٌ قَالَ أَبُو النَّضْرِ لَا يُخْرِجَنَّكُمُ الْفِرَارُ مِنْهُ