Bara bin Azib reported,

The Messenger of Allah ﷺ prayed facing Bayt al-Maqdis for sixteen or seventeen months, then he was directed toward the Kaabah, which was something he had longed for. So Allah عز وجل revealed, "We have certainly seen the turning of your face toward the heaven, so We will surely turn you to a qiblah with which you will be pleased. So turn your face toward al-Masjid al-Haram" [Baqarah 2:144].A man who had prayed the afternoon prayer with the Prophet ﷺ passed by some people from the Ansar while they were bowing in the afternoon prayer facing Bayt al-Maqdis. He said, "I bear witness that I prayed with the Messenger of Allah ﷺ and that he has been directed toward the Kaabah."So they turned to face the Kaabah while still bowing in the afternoon prayer.

Ahmad 18707

Sahih

حدثنا وكيع حدثنا إسرائيل عن أبي إسحاق

عن البراء بن عازب قال

صلى رسول الله ﷺ نحو بيت المقدس ستة عشر شهرا أو سبعة عشر شهرا ثم وجه إلى الكعبة وكان يحب ذلك فأنزل الله عز وجل {قد نرى تقلب وجهك في السماء فلنولينك قبلة ترضاها فول وجهك شطر المسجد الحرام} الآية قال فمر رجل صلى مع النبي ﷺ العصر على قوم من الأنصار وهم ركوع في صلاة العصر نحو بيت المقدس فقال هو يشهد أنه صلى مع رسول الله ﷺ وأنه قد وجه إلى الكعبة قال فانحرفوا وهم ركوع في صلاة العصر

أحمد 18707صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Bara bin Azib
Numbering
Darussalam 18707
Ahmad 18707