In the very early years of Islam, Muslims prayed facing Jerusalem. Here’s the context:

1. Early Qibla
After Muhammad began preaching in Mecca, Muslims initially prayed toward Jerusalem.
This reflected a spiritual link to the earlier Abrahamic prophets (Judaism and Christianity), showing continuity in the tradition.
2. Change to Mecca
About 16–18 months after the Hijra (Muhammad’s migration to Medina in 622 CE), the Qibla (prayer direction) was changed from Jerusalem to the Kaaba in Mecca.
The change is mentioned in the Qur’an, Surah Al-Baqarah (2:144):
“So turn your face toward al-Masjid al-Haram (the Sacred Mosque in Mecca); and wherever you [believers] are, turn your faces toward it.”
3. Reasons for the Change
- Religious identity: To establish a distinct Islamic identity separate from Jews and Christians.
- Connection to Abraham: The Kaaba is associated with Prophet Abraham and his son Ishmael, giving Islam a direct link to monotheistic origins.
- Unity in prayer: To have a single direction for all Muslims, unifying the community.
4. Spiritual Legacy
Al-Aqsa Mosque and Jerusalem remained highly significant, symbolizing the Prophet’s Night Journey (Isra’ and Mi‘raj).
It is still considered the third holiest site in Islam after Mecca and Medina.