The Messenger of Allah ﷺ used to pray facing Bayt al-Maqdis when the verse was revealed, "Indeed We see the turning of your face toward heaven, so We will surely turn you to a qiblah with which you will be pleased. So turn your face toward the Sacred Mosque" [Baqarah 2:144].A man from Banu Salama passed by while they were bowing during the dawn prayer, having already completed one rakah, and he called out, "The qiblah has been changed!" So they turned, as they were, toward the new qiblah.
أن رسول الله ﷺ كان يصلي نحو بيت المقدس فنزلت: {قد نرى تقلب وجهك في السماء فلنولينك قبلة ترضها فول} فنزل {وجهك شطر المسجد الحرام} [ سورة البقرة: ١٤٤]، فمر رجل من بني سلمة، وهم ركوع في صلاة الفجر، وقد صلوا ركعة فنادى: ألا إن القبلة حولت، فمالوا كما هم نحو القبلة.
Muslim reported it in the Chapter on Mosques (527), from Abu Bakr bin Abu Shayba, who said, Affan narrated to us, who said, Hammad bin Salama narrated to us, from Thabit, from Anas, and he mentioned something similar. The rest of the hadiths about the change of qibla will come later, Allah willing, in the Book of Tafsir.There is no contradiction between these hadiths. It is explicitly stated in the hadith of Ibn Umar that the Quran verse was revealed at night. Someone went to Quba while the people there were praying Fajr. Likewise, someone went to the dwellings of Banu Salama, as in the hadith of Anas, while they were praying the dawn prayer, and he called out, "The qibla has indeed changed," so they turned. In the hadith of Bara bin Azib, as found in Sahih Bukhari, a man had prayed with ﷺ (most likely this refers to Dhuhr), then went to a group of the Ansar while they were praying Asr, and testified that the qibla had changed, so they turned. However, Muslim did not mention the time of the prayer.