Praise be to Allah.
The story of the change of the qiblah from Bayt al-Maqdis (Jerusalem) to al-Masjid al-Haraam (Makkah) is proven in the Qur’an, and is also proven in some detail in the Prophet’s Sunnah.
Allah, may He be exalted, says (interpretation of the meaning):
“The fools (pagans, hypocrites, and Jews) among the people will say, ‘What has turned them (Muslims) from their Qiblah (prayer direction (towards Jerusalem)) to which they were used to face in prayer?’ Say, (O Muhammad SAW) ‘To Allah belong both, east and the west. He guides whom He wills to a Straight Way.’
Thus We have made you (true Muslims - real believers of Islamic Monotheism, true followers of Prophet Muhammad SAW and his Sunnah (legal ways)), a Wasat (just) (and the best) nation, that you be witnesses over mankind and the Messenger (Muhammad SAW) be a witness over you. And We made the Qiblah (prayer direction towards Jerusalem) which you used to face, only to test those who followed the Messenger (Muhammad SAW) from those who would turn on their heels (i.e., disobey the Messenger). Indeed it was great (heavy) except for those whom Allah guided. And Allah would never make your faith (prayers) to be lost (i.e., your prayers offered towards Jerusalem). Truly, Allah is full of kindness, the Most Merciful towards mankind.
Verily! We have seen the turning of your (Muhammad’s SAW) face towards the heaven. Surely, We shall turn you to a Qiblah (prayer direction) that shall please you, so turn your face in the direction of Al-Masjid- al-Haram (at Makkah). And wheresoever you people are, turn your faces (in prayer) in that direction. Certainly, the people who were given the Scriptures (i.e., Jews and the Christians) know well that, that (your turning towards the direction of the Ka‘bah at Makkah in prayers) is the truth from their Lord. And Allah is not unaware of what they do.”
Al-Bukhaari (41) narrated from al-Bara’ ibn ‘Aazib that when the Prophet (blessings and peace of Allah be upon him) first came to Madinah, he stayed with his grandfathers or his maternal uncles among the Ansaar, and he prayed facing towards Bayt al-Maqdis for sixteen or seventeen months. But he wanted his qiblah to be towards the Ka‘bah. The first prayer he offered (after the qiblah was changed) was ‘Asr prayer, and some people prayed with him. Then one of the men who had prayed with him went out and passed by some people who were praying in a mosque, and they were bowing. He said: I bear witness by Allah that I (just) prayed with the Messenger of Allah (blessings and peace of Allah be upon him) facing towards Makkah. And they turned around, as they were, to face towards the Ka‘bah. The Jews and the People of the Book used to like it when he prayed facing towards Bayt al-Maqdis, and when he turned to face towards the Ka‘bah, they did not like that.
Muslim (527) narrated from Anas that the Messenger of Allaah (blessings and peace of Allah be upon him) used to pray towards Bayt al-Maqdis, then it was revealed: “Verily, We have seen the turning of your (Muhammad’s) face towards the heaven. Surely, We shall turn you to a Qiblah (prayer direction) that shall please you, so turn your face in the direction of Al-Masjid Al-Haraam (at Makkah)” [al-Baqarah 2:144]. A man passed by Banu Salamah whilst they were bowing in Fajr prayer, and they had prayed one rak'ah. He called out: The qiblah has been changed, and they turned as they were towards the qiblah.
Muslim also narrated (526) that Ibn ‘Umar said: Whilst the people were praying Fajr in Quba’, someone came to them and said: Revelation came to the Messenger of Allah (blessings and peace of Allah be upon him) last night and he was commanded to face towards the Ka‘bah, so face towards it. They were facing towards Syria, so they turned to face the Ka‘bah.
With regard to the manner in which the Sahaabah (may Allah be pleased with them) turned around whilst they were praying when news reached them that the qiblah had been changed, it was as follows:
The imam turned around, and those who were with him shifted from their places in a half circle, so that the imam shifted the back of the mosque, on the side closest to the Ka‘bah, and the men ended up behind him, and the women ended up where the men had been originally.
The word translated as turned around in the hadeeths quoted above does not mean that the imam cut through the rows; rather it may be understood that what happened was simply that he shifted.
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said: An explanation of how they turned around is given in the hadeeth of Thuwaylah bint Aslam, which was narrated by Ibn Abi Haatim, and I said something similar. She said: The women moved to the men’s place, and the men moved to the women’s place, and we prayed the last two rak‘ahs facing towards the Sacred House (the Ka‘bah).
I say: To give a vivid image of what happened, the imam shifted from his place at the front of the mosque to the back of the mosque, because the one who faces towards the Ka‘bah [in Madinah] will have Bayt al-Maqdis at his back. If he had turned around on the spot, there would not have been enough room behind him for the rows of worshippers. When the imam shifted, the men also shifted until they were behind him, and the women shifted until they were behind the men. This requires a great deal of movement in the prayer; it is possible that this happened before the prohibition on moving a great deal in the prayer, and it probably also happened before the prohibition on talking during the prayer. Or it may be understood as meaning that the actions mentioned were overlooked because of the great significance of the matter in question. Or it may be that when they shifted, they did not move all in one go; rather it was a gradual shifting. And Allah knows best.
End quote from Fath al-Baari, 1/506-507
See also: Tafseer Ibn Katheer, 1/167, 470
Visiting the “seven places” (or the “seven mosques”) in Madinah with the intention of worship and attaining reward is not prescribed in Islam.
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allah have mercy on him) said: With regard to the seven mosques, Masjid al-Qiblatayn, and other places that are mentioned by some writers as places to be visited as part of the rituals, there is no basis or evidence for that. What is prescribed for the believer at all times is to follow and not innovate.
End quote from Majmoo‘ Fataawa Ibn Baaz, 6/321
For more information, please see the answer to question no. 11669.
And Allah knows best.