Qibla is the direction in which Muslims stand before Allah every day, five times a day, to offer their daily prayers. This direction is the one facing the sacred mosque of Holy Ka'bah in Makkah, Saudi Arabia.
Found at the core of Jerusalem is Al-Haram al-Sharif, which covers over thirty five acres of buildings, gardens and famous domes. Al-Aqsa Mosque is situated at its southernmost side and the celebrated Dome of the Rock is in the middle. This entire expanse is known as ‘Bait-ul Maqdis’ and it covers nearly 1/6th of the walled city of Jerusalem.
During the initial years of prophethood, Hazrat Muhammad (saw) offered his prayers facing Baitul-Maqdis, which was the earliest divinely decreed Qibla for Muslims during that time. This continued even after the Prophet’s (saw) migration to Madina, for a total of seventeen months.
The Qibla of Baitul-Maqdis was also shared with the Jews in Madina, who also offered their prayers by turning towards Baitul-Maqdis. They were not particularly pleased with this common Qibla with the Muslims and felt threatened by the rapid rise of Islam which was slowly leading to a decrease in the power and impact of Jews in the peninsula. Hence, they made it a point to purposely discredit Islam and Prophet Mohammed (saw). Amongst other things, they said "Mohammed claims to have a religion whose laws supersede all other previous laws, yet he does not have an independent Qibla, and offers his prayers facing the Qibla of the Jews". To this, Allah mentions in the Quran:
“The fools (pagans, hypocrites and Jews) among the people will say: What has turned them (Muslims) from their Qiblah which they had? Say (O Mohammed): The East and the West belong only to Allah; He guides whom He likes to the right path” (Quran 2:142).
However, after constant ridicule and demeaning talks, the Prophet Mohammed (saw) looked to Allah for guidance and it is said that he used to go out and look at the sky, waiting for a sign or revelation from Allah regarding this specific matter. And as Allah never forsakes his believers, a verse was revealed to the Prophet (saw) soon after: "Indeed We see the turning of your [Prophet Mohammed (saw)] face to heaven, so We shall surely turn you to a Qibla which you shall like; turn then your face towards the Sacred Mosque, and wherever you are, turn your face towards it, and those who have been given the Book (i.e. Jews and the Christians) most surely know that it is the truth from their Lord; and Allah is not at all heedless of what they do. (2:144)"
...We shall surely turn you to a Qiblah which you shall like;...and those who have been given the Book (i.e. Jews and the Christians) most surely know that it is the truth from their Lord; and Allah is not at all heedless of what they do.(2:144)
From this verse, it becomes apparent that the shift in Qibla was not a consequence of the obstruction by Jews, but this shift posed as a test; the main aim was to discern the true believers from the unbelievers, whose faith was not sincere. God wanted Prophet Mohammed (saw) to be able to recognize the true Muslims. This is confirmed in this verse of the Glorious Qur'an:"And thus We have made you a medium (just) nation that you may be the bearers of witness to the people and (that) the Messenger may be a bearer of witness to you; and We made the Qiblah (prayer direction towards Jerusalem) which you used to face, only to test those who followed the Messenger from those who would turn back upon their heels, and this was surely hard except for those whom Allah has guided aright; and Allah was not going to make your faith (prayers) to be fruitless (i.e. your prayers offered towards Jerusalem); most surely Allah is Affectionate, Merciful to the people." (2:143)
...and We made the Qiblah (prayer direction towards Jerusalem) which you used to face, only to test those who followed the Messenger from those who would turn back upon their heels...(2:143)
Another reason behind the shift, which is evident in Islamic history and the prevailing conditions in the Peninsula at the time, was the fact that the Ka'bah itself had been built by Prophet Ibrahim, who was a respected figure across Arabia. Through the declaration of Ka'bah as the Qibla, it secured the satisfaction and support of the Arabic society and posed as an attraction for them to come towards Islam.
One day, during one of the congregational prayers being led by Prophet Mohammed (saw), Allah sent the Angel Jibraeel (as) to inform the Prophet of the change in Qibla, from Baitul-Maqdis to the Sacred Mosque of Holy Kaabah in Makkah, Saudi Arabia. Upon completion of two Rakaah’ of the congregational prayer, Hazrat Jibraeel (as) communicated this divine command of Allah to the Prophet (saw); Jibraeel (as) took the hand of the Prophet (saw) and slowly guided him to turn towards the direction of the Ka'bah in Masjid al-Haram. Prophet Mohammed (saw) shifted and changed his direction immediately while being in the middle of the prayer. Hazrat Ali (RA) saw the Prophet’s shift in direction and followed at once. This stirred a lot of confusion amongst the other Muslims present there and only some of them followed the action like Hazrat Ali (RA) did.
The interesting thing to note here is that the mosque where this incident took place is known as "Masjid-e-Dhul Qiblatain" or "Masjid Al-Qiblatain" meaning "A mosque with two Qibla”. It’s one of the oldest and most famous mosques in the history of Islam. It exists to this day in Madina, just a couple of kilometers from Masjid al-Nabawi. It comprised of 2 Mihrabs; one facing "Baitul-Maqdis" and the other facing "Masjid al-Haram".
This whole incident can be considered one the divine miracles of Prophet Mohammed (saw), where he knew exactly where to turn and to what degree in order to face the Ka'bah without the help of any external instrument. After all, Islam is a religion full of miracles!