Ibn Kathīr said, “The point is that Medina will remain inhabited and flourishing during the time of al-Dajjāl. It will remain so during the time of Jesus son of Mary, the Messenger of Allah (peace be upon him), until he dies and is buried there. Only afterward will it fall into ruin” (1).
He then cited the hadith of Jābir (may Allah be pleased with him), who said: Umar ibn al-Khattāb informed me that he heard the Messenger of Allah (may Allah bless him and grant him peace) say, “A rider will surely pass through the environs of Medina and then say, ‘Many Muslims once lived here.’”
It was narrated by Imam Ahmad (2).
The hadith master Ibn Hajar said, “Umar ibn Shabba narrated with an authentic chain from Awf ibn Mālik, who said: The Messenger of Allah (may Allah bless him and grant him peace) entered the mosque, then looked at us and said, ‘By Allah, its people will surely leave it unguarded and freely accessible to wild creatures for forty years. Do you know what is meant by “wild creatures”? Birds and beasts of prey.’”
Ibn Hajar then said, “This has certainly not occurred” (3).
This indicates that people will leave Medina entirely near the end of time, after the emergence of al-Dajjāl and the descent of Jesus son of Mary (peace be upon him). It may occur when the Fire that will gather the people emerges. This is the last of the portents of the Hour and the first indication that the Hour itself is beginning; nothing will remain after it but the Hour.