Al-Bara' bin 'Azib (RA) reported: I said prayer with the Apostle (ﷺ) turning towards Bait-ul-Maqdis for sixteen months till this verse of Surah Baqarah was revealed:" And wherever you are turn your faces towards it" (ii. 144). This verse was revealed when the Apostle (ﷺ) had said prayer. A person amongst his people passed by the people of Ansar as they were engaged in prayer. He narrated to them (this command of Allah) and they turned their faces towards the Ka’bah.
Hadith Referenceصحيح مسلم / كتاب المساجد ومواضع الصلاة / 525
Abu Ishaq reported: I heard al-Bara' saying: We prayed with the Messenger of Allah (ﷺ) (with our faces) towards Bait-ul-Maqdis for sixteen months or seventeen months. Then we were made to change (our direction) towards the Ka’bah.
Hadith Referenceصحيح مسلم / كتاب المساجد ومواضع الصلاة / 525
Narrated to us by Shaiban ibn Farrukh, narrated to us by Abdul Aziz ibn Muslim, narrated to us by Abdullah ibn Dinar, from Ibn Umar. And narrated to us by Qutaibah ibn Sa'id, and the wording is his, from Malik ibn Anas, from Abdullah ibn Dinar, from Ibn Umar, who said: While the people were in the morning prayer at Quba', a man came to them and said: "The Messenger of Allah, peace and blessings be upon him, has had something revealed to him during the night, and he has been commanded to face the Ka'bah, so face it." Their faces had been towards Sham, so they turned towards the Ka'bah.
Hadith Referenceصحيح مسلم / كتاب المساجد ومواضع الصلاة / 526
Anas reported: The Messenger of Allah (ﷺ) used to pray towards Bait-ul-Maqdis, that it was revealed (to him):" Indeed We see the turning of the face to heaven, wherefore We shall assuredly cause thee to turn towards Qibla which shall please thee. So turn thy face towards the sacred Mosque (Ka’bah)" (ii. 144). A person from Banu Salama was going; (he found the people) in ruk'u (while) praying the dawn prayer and they had said one rak'ah. He said in a loud voice: Listen! the Qibla has been changed and they turned towards (the new) Qibla (Ka’bah) in that very state.
Hadith Referenceصحيح مسلم / كتاب المساجد ومواضع الصلاة / 527