Sahih al-Bukhari 6973
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
إِذَا سَمِعْتُمْ بِأَرْضٍ فَلاَ تَقْدَمُوا عَلَيْهِ، وَإِذَا وَقَعَ بِأَرْضٍ وَأَنْتُمْ بِهَا فَلاَ تَخْرُجُوا فِرَارًا مِنْهُ "
Narrated `Abdullah bin 'Amir bin Rabi`a:
`Umar bin Al-Khattab left for Sham, and when he reached a placed called Sargh, he came to know that there was an outbreak of an epidemic (of plague) in Sham. Then `AbdurRahman bin `Auf told him that Allah's Messenger (ﷺ) said, "If you hear the news of an outbreak of an epidemic (plague) in a certain place, do not enter that place: and if the epidemic falls in a place while you are present in it, do not leave that place to escape from the epidemic." So `Umar returned from Sargh.
Full reference and source
Sahih al-Bukhari 6973 In-book : Book 90, Hadith 20 USC-MSA web (English) : Vol. 9, Book 86, Hadith 103 (deprecated)
View source on Sunnah.com (opens in a new tab)