Anas bin Malik reported,

The Prophet ﷺ and his companions used to pray toward Bayt al-Maqdis. When this verse was revealed, "Turn your face toward al-Masjid al-Haram, and wherever you are, turn your faces toward it" [Baqarah 2:144], a man from the Banu Salama passed by them while they were bowing in the dawn prayer facing Bayt al-Maqdis. He called out to them twice, "The qiblah has been changed to the Kaabah!" So they turned, while still bowing, toward the Kaabah.

Abu Dawud 1045

Sahih

حدثنا موسى بن إسمعيل حدثنا حماد عن ثابت وحميد

عن أنس

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

أبو داود 1045صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Abu Dawud
Book
Prayer
Chapter
One who prayed facing other than the qibla then found out
Numbering
Darussalam 1045
Abu Dawud 1045