Bara bin Azib reported,

I prayed with the Prophet ﷺ facing Bayt al-Maqdis for sixteen months, until the verse in al-Baqarah was revealed, "And wherever you are, turn your faces toward it" [Baqarah 2:144]. It was revealed after the Prophet ﷺ had finished praying. A man from the group set off and passed by some people of the Ansar who were praying, and he told them about it, so they turned their faces toward the House.

Muslim 1176

Sahih

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

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

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

مسلم 1176صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Mosques and places of prayer
Chapter
Changing the qibla from Jerusalem to the Kaaba
Numbering
Darussalam 1176
Muslim 1176