All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
Even if Makkah and Madeenah are protection from Ad-Dajjaal (anti-Christ), none of their inhabitants knows where he will be when Ad-Dajjaal appears. We do not know how the questioner can say: '…when they are certain that they are going to stay there only until their death...' when the unseen is known only by Allaah; Allaah, The Almighty, says (what means): {…and no soul perceives what it will earn tomorrow, and no soul perceives in what land it will die.}[Quran 31:34]
The Prophet, sallallaahu ‘alayhi wa sallam, also said: "If Allaah wants to take a person's soul in a particular land, He will give him a reason to go there." [Ahmad, Al-Bukhari in Al-Adab Al-Mufrad - Al-Albaani graded it Saheeh (sound)]
Moreover, if Ad-Dajjaal will not be able to enter Madeenah, this does not mean that no one will come out of it and follow him, and therefore no one can do without that supplication. Anas ibn Maalik narrated that the Prophet, sallallaahu ‘alayhi wa sallam, said: "Ad-Dajjaal will come and encamp at a place close to Madeenah and then Madeenah will shake thrice and all the non-believers and the hypocrites will come out of it towards him." [Al-Bukhari and Muslim]
It is sufficient for us that the Prophet, sallallaahu ‘alayhi wa sallam, has taught his honorable Companions this supplication while they are the people and inhabitants of that sacred place. They learned that by heart, acted upon it and taught it to those who came after them. And they are an excellent model and example for us.
Allaah Knows best.