Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
muslim:525bMuḥammad b. al-Muthanná And ʾAbū Bakr b. Khalāad > Yaḥyá > Ibn al-Muthanná > Yaḥyá b. Saʿīd > Sufyān > Abū Isḥāq > al-Barāʾ

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.  

مسلم:٥٢٥bحَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى وَأَبُو بَكْرِ بْنُ خَلاَّدٍ جَمِيعًا عَنْ يَحْيَى قَالَ ابْنُ الْمُثَنَّى حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ عَنْ سُفْيَانَ حَدَّثَنِي أَبُو إِسْحَاقَ قَالَ

سَمِعْتُ الْبَرَاءَ يَقُولُ صَلَّيْنَا مَعَ رَسُولِ اللَّهِ ﷺ نَحْوَ بَيْتِ الْمَقْدِسِ سِتَّةَ عَشَرَ شَهْرًا أَوْ سَبْعَةَ عَشَرَ شَهْرًا ثُمَّ صُرِفْنَا نَحْوَ الْكَعْبَةِ  


See similar narrations below:

Collected by Bukhārī, Nasāʾī, Aḥmad
bukhari:4492Muḥammad b. al-Muthanná > Yaḥyá > Sufyān > Abū Isḥāq > al-Barāʾ

We prayed along with the Prophet ﷺ facing Jerusalem for sixteen or seventeen months. Then Allah ordered him to turn his face towards the Qibla (in Mecca):-- "And from whence-so-ever you start forth (for prayers) turn your face in the direction of (the Sacred Mosque of Mecca) Al-Masjid-ul Haram.." (2.149)  

البخاري:٤٤٩٢حَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى حَدَّثَنَا يَحْيَى عَنْ سُفْيَانَ حَدَّثَنِي أَبُو إِسْحَاقَ قَالَ سَمِعْتُ الْبَرَاءَ ؓ قَالَ

صَلَّيْنَا مَعَ النَّبِيِّ ﷺ نَحْوَ بَيْتِ الْمَقْدِسِ سِتَّةَ عَشَرَ أَوْ سَبْعَةَ عَشَرَ شَهْرًا ثُمَّ صَرَفَهُ نَحْوَ الْقِبْلَةِ  

nasai:488Muḥammad b. Bashhār > Yaḥyá b. Saʿīd > Sufyān > Abū Isḥāq > al-Barāʾ

"We prayed toward Bait Al-Maqdis (Jerusalem) with the Messenger of Allah ﷺ for sixteen or seventeen months - Safwan was not sure - then it was changed to the Qiblah."  

النسائي:٤٨٨أَخْبَرَنَا مُحَمَّدُ بْنُ بَشَّارٍ قَالَ حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ حَدَّثَنَا سُفْيَانُ قَالَ حَدَّثَنَا أَبُو إِسْحَاقَ عَنِ الْبَرَاءِ قَالَ

صَلَّيْنَا مَعَ النَّبِيِّ ﷺ نَحْوَ بَيْتِ الْمَقْدِسِ سِتَّةَ عَشَرَ شَهْرًا أَوْ سَبْعَةَ عَشَرَ شَهْرًا شَكَّ سُفْيَانُ وَصُرِفَ إِلَى الْقِبْلَةِ  

ahmad:18539Yaḥyá > Sufyān > Abū Isḥāq > al-Barāʾ

"We prayed toward Bait Al-Maqdis (Jerusalem) with the Messenger of Allah ﷺ for sixteen or seventeen months - Safwan was not sure - then it was changed to the Qiblah." (Using translation from Nasāʾī 488)   

أحمد:١٨٥٣٩حَدَّثَنَا يَحْيَى عَنْ سُفْيَانَ حَدَّثَنِي أَبُو إِسْحَاقَ قَالَ سَمِعْتُ الْبَرَاءَ قَالَ

صَلَّيْنَا مَعَ رَسُولِ اللهِ ﷺ نَحْوَ بَيْتِ الْمَقْدِسِ سِتَّةَ عَشَرَ شَهْرًا أَوْ سَبْعَةَ عَشَرَ شَهْرًا شَكَّ سُفْيَانُ ثُمَّ صُرِفْنَا قِبَلَ الْكَعْبَةِ