Prophet Muhammad (saw) advised quarantining to contain a deadly outbreak. He said:
“If you hear of an outbreak of plague in a land, do not enter it; if the plague breaks out in a place while you are in it, do not leave that place.”
-Reference: Bukhari 5728
Aside from a prescription for public health, this hadith imparts two moral responsibilities:
1. To avoid endangering your health.
2. To prevent endangering another's health.
That is really Islamic spirit, to protect the well being of other creatures.
Stay safe.