Allah has confirmed His Messenger's vision with truth:
You will enter the Masjid al-Haram [Sacred Mosque] in safety, Allah willing,
shaving your heads and cutting your hair without any fear.
He knew what you did not know and ordained, in place of this, an imminent victory.
In Surat al-Fath 27, Allah revealed to the Prophet (saas) that He would help and support him, that the dream was true, and that the believers would enter Makkah. A short while later, with the Treaty of Hudaybiyah and the conquest of Makkah, the believers entered the Sacred Mosque in complete safety, just as the dream had foretold. That was how Allah showed that it had been His will that the Prophet's (saas) dream be fulfilled.
On closer consideration, this verse can be seen to announce yet another victory that will take place before Makkah's capture: the capture of the Khyber Fortress, which was under the control of the Jews, before they entered Makkah.183
Other verses that give the glad tidings of Makkah's conquest are given below:
He held their hands back from you, and your hands from them in the valley of Makkah,
after giving you the upper hand over them. Allah sees what you do.
Truly We have granted you a clear victory, so that Allah may forgive you your earlier errors and any later ones, complete His blessing upon you, and guide you on a Straight Path.
And so that Allah may help you with a mighty help.
Surat al-Isra' 76 states that the unbelievers cannot stay in Makkah:
They were very near to scaring you from the land with the object of expelling you from it.
But had they done so, they would only have remained there a short time after you.
The Prophet (saas) entered Makkah and conquered it in 8 ah (630). Two years later, all of the unbelievers left Makkah, just as Allah had said that they would. Another point that should be noted here is that when the Prophet (saas) gave that good news to the believers, it looked totally out of the question. In fact, the situation pointed in quite the opposite direction, and the polytheists appeared quite determined never to let the believers enter Makkah. As a result, those who had doubts in their hearts began to doubt the Prophet's (saas) words. Yet, the Prophet (saas) trusted in Allah, paid no attention to the doubters' words, and told people what Allah had revealed to him. The Qur'an confirmed his words, and the prediction was fulfilled shortly afterwards.
Source : MIRACLES OF THE QUR'AN.com