Sahih Muslim , Hadith 525 ⓘ
Al-Bara' b. 'Azib reported: I said prayer with the Apostle turning towards Bait-ul-Maqdis for sixteen months till this verse of Surah Baqara wis 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'ba.
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا أَبُو الأَحْوَصِ، عَنْ أَبِي إِسْحَاقَ، عَنِ الْبَرَاءِ بْنِ عَازِبٍ، قَالَ صَلَّيْتُ مَعَ النَّبِيِّ صلى الله عليه وسلم إِلَى بَيْتِ الْمَقْدِسِ سِتَّةَ عَشَرَ شَهْرًا حَتَّى نَزَلَتِ الآيَةُ الَّتِي فِي الْبَقَرَةِ { وَحَيْثُمَا كُنْتُمْ فَوَلُّوا وُجُوهَكُمْ شَطْرَهُ} فَنَزَلَتْ بَعْدَ مَا صَلَّى النَّبِيُّ صلى الله عليه وسلم فَانْطَلَقَ رَجُلٌ مِنَ الْقَوْمِ فَمَرَّ بِنَاسٍ مِنَ الأَنْصَارِ وَهُمْ يُصَلُّونَ فَحَدَّثَهُمْ فَوَلَّوْا وُجُوهَهُمْ قِبَلَ الْبَيْتِ .
also referenced under: Book 5, Hadith 16 (In-Book) & Book 4, Hadith 1071 (USC-MSA)
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'ba.
حَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى، وَأَبُو بَكْرِ بْنُ خَلاَّدٍ جَمِيعًا عَنْ يَحْيَى، - قَالَ ابْنُ الْمُثَنَّى حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ، - عَنْ سُفْيَانَ، حَدَّثَنِي أَبُو إِسْحَاقَ، قَالَ سَمِعْتُ الْبَرَاءَ، يَقُولُ صَلَّيْنَا مَعَ رَسُولِ اللَّهِ صلى الله عليه وسلم نَحْوَ بَيْتِ الْمَقْدِسِ سِتَّةَ عَشَرَ شَهْرًا أَوْ سَبْعَةَ عَشَرَ شَهْرًا ثُمَّ صُرِفْنَا نَحْوَ الْكَعْبَةِ .
also referenced under: Book 5, Hadith 17 (In-Book) & Book 4, Hadith 1072 (USC-MSA)