Sahih al-Bukhari 4486
Abu Nu'aim narrated to us that he heard from Zuhair. He narrated from Abu Ishaq, Abu Ishaq from Hazrat Bara' (bin Azib) (ra), that the Messenger of Allah (saw) offered Prayer (Salat) facing Baitul Maqdis for sixteen or seventeen months, and he wished that his direction would be towards the House of Allah (Baitullah). He offered the Asr Prayer (facing the House of Allah), and some people also offered this Prayer with him. Then one of those who had offered this Prayer with him went out and passed by the people of a mosque while they were bowing (in Ruku'). He said: I swear by Allah and bear witness that I have offered Prayer with the Prophet (saw) facing Mecca. So they turned, in the very state in which they were, towards the House of Allah. And those who had died while still on the former Qiblah, before it was changed towards the House of Allah, were (people who had been) martyred (in battles). We did not know what to say about them. Therefore Allah revealed: “And it does not behove Allah to let your faith go in vain; surely, Allah is Compassionate and Merciful to the people” (Qur’an 2:144).
AI-translated by Islam-Today