In this age of extensive cross country travelling, and also of continuously emerging contagious diseases, governments have been forming new rules and regulations, medical procedures and visa restrictions for epidemic containment. Muhammad too thought along the same lines..
Prophet said, "If you hear of an outbreak of plague in a land, do not
enter it: but if the plague breaks out in a place while you are in it,
do not leave that place."
(Sahih Bukhari 7.624)
So simple. Beautiful. Common sensical..