Narrated Usama bin Zaid: Allah’s Messenger, peace be upon him, 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, do not approach it, and if 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).”
[4: 679- O.B. Sahih Al-Bukhari)

Narrated Ayesha: I asked Allah’s Messenger, peace be upon him, about the plague. He told me that it was a punishment sent by Allah on whom He wished. Allah made it a source of mercy for the believers. If one stays in the country at the time of plague patiently hoping for Allah’s reward and believing that nothing will befall him except what Allah has written for him, he will get a reward similar to that of a martyr.”
[4: 680- O.B. Sahih Al-Bukhari)