2:142
۞ سَيَقُولُ ٱلسُّفَهَآءُ مِنَ ٱلنَّاسِ مَا وَلَّىٰهُمْ عَن قِبْلَتِهِمُ ٱلَّتِى كَانُوا۟ عَلَيْهَا ۚ قُل لِّلَّهِ ٱلْمَشْرِقُ وَٱلْمَغْرِبُ ۚ يَهْدِى مَن يَشَآءُ إِلَىٰ صِرَٰطٍۢ مُّسْتَقِيمٍۢ
The foolish among the people will say, "What has turned them away from their qiblah, which they used to face?" Say, "To Allah belongs the east and the west. He guides whom He wills to a straight path."
Translation · Saheeh International
Tafsir
Ibn Kathīr (abridged)
Changing the Qiblah @ Direction of the Prayer
Imam Al-Bukhari reported that Al-Bara' bin `Azib narrated: "Allah's Messenger ﷺ offered his prayers facing Bayt Al-Maqdis (Jerusalem) for sixteen or seventeen months, but he wished that he could pray facing the Ka`bah (at Makkah). The first prayer which he offered (facing the Ka`bah) was the `Asr (Afternoon) prayer in the company of some people. Then one of those who had offered that prayer with him, went out and passed by some people in a mosque who were in the bowing position (in Ruku`) during their prayers (facing Jerusalem). He addressed them saying, `By Allah, I bear witness that I have offered prayer with the Prophet facing Makkah (Ka`bah).' Hearing that, those people immediately changed their direction towards the House (Ka`bah) while still as they were (i.e., in the same bowing position). Some Muslims who offered prayer towards the previous Qiblah (Jerusalem) before it was changed towards the House (the Ka`bah in Makkah) had died or had been martyred, and we did not know what to say about them (regarding their prayers towards Jerusalem). Allah then revealed:
وَمَا كَانَ اللَّهُ لِيُضِيعَ إِيمَـنَكُمْ إِنَّ اللَّهَ بِالنَّاسِ لَرَءُوفٌ رَّحِيمٌ
(And Allah would never make your faith (prayers) to be lost (i.e., the prayers of those Muslims were valid)) (2:143)."
Al-Bukhari collected this narration, while Muslim collected it using another chain of narrators. Muhammad bin Ishaq reported that Al-Bara' narrated: Allah's Messenger ﷺ used to offer prayers towards Bayt Al-Maqdis (in Jerusalem), but would keep looking at the sky awaiting Allah's command (to change the Qiblah). Then Allah revealed:
قَدْ نَرَى تَقَلُّبَ وَجْهِكَ فِي السَّمَآءِ فَلَنُوَلِّيَنَّكَ قِبْلَةً تَرْضَاهَا فَوَلِّ وَجْهَكَ شَطْرَ الْمَسْجِدِ الْحَرَامِ