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.
حدثنا موسى بن إسمعيل حدثنا حماد عن ثابت وحميد
أن النبي ﷺ وأصحابه كانوا يصلون نحو بيت المقدس فلما نزلت هذه الآية {فول وجهك شطر المسجد الحرام وحيث ما كنتم فولوا وجوهكم شطره} فمر رجل من بني سلمة فناداهم وهم ركوع في صلاة الفجر نحو بيت المقدس ألا إن القبلة قد حولت إلى الكعبة مرتين فمالوا كما هم ركوع إلى الكعبة