...For Muslims, Jerusalem is thought to be sacred for two reasons: First, Muslims were initially commanded to pray toward Jerusalem. But when the Jews refused to convert to Islam, Muhammad changed the prayer direction toward Mecca. Second, Muslims believe that Muhammad ascended to heaven and back from "the Rock" which much later after his death was interpreted to mean what is today the Dome of the Rock in Jerusalem.
Interestingly, Islamic sources from the first 50 years or so after Muhammad's death make clear that Jerusalem had absolutely no holy status for Muslims.
Some centuries later, Ibn Taymiyya (1263–1328) another important Muslim cleric with an encyclopedic knowledge of the Koran and Hadith, wrote extensively about Jerusalem, and how there were only two holy cities in Islam – Mecca and Medina...
Ibn Taymiyya went to great lengths to explain that the veneration of Jerusalem in nothing more than the "Judaization" of Islam...
Later, Ibn Taymiyya discussed the first caliphs and showed that when they ruled over today's Syria, Lebanon, Jordan, and Israel, neither they nor any of the early governors nor any clerics made any attempt to build any structure over the Rock on the Temple Mount...How then, Ibn Taymiyya reasoned, could we who never knew them nor Muhammad have the right to disagree? There is no way we could know more about Islam than they. We therefore have no right to sanctity al-Aqsa because they did not do so.
In order to further strengthen his argument against Jerusalem's sanctity, Ibn Taymiyya wrote that during Muhammad's night journey to heaven from Jerusalem, there is no mention of the (Temple) Rock in the story. Therefore, since the Rock is not even mentioned, it has no importance in Islamic tradition.
...So how did Jerusalem become holy in Islam?