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.
bukhari:4488Musaddad > Yaḥyá > Sufyān > ʿAbdullāh b. Dīnār > Ibn

While some people were offering Fajr prayer in the Quba' mosque, some-one came and said, "Allah has revealed to the Prophet ﷺ Qur'anic instructions that you should face the Kaʿba (while praying) so you too, should face it." Those people then turned towards the Kaʿba.  

البخاري:٤٤٨٨حَدَّثَنَا مُسَدَّدٌ حَدَّثَنَا يَحْيَى عَنْ سُفْيَانَ عَنْ عَبْدِ اللَّهِ بْنِ دِينَارٍ عَنِ ابْنِ عُمَرَ ؓ بَيْنَا النَّاسُ يُصَلُّونَ الصُّبْحَ فِي مَسْجِدِ قُبَاءٍ إِذْ جَاءَ جَاءٍ فَقَالَ

أَنْزَلَ اللَّهُ عَلَى النَّبِيِّ ﷺ قُرْآنًا أَنْ يَسْتَقْبِلَ الْكَعْبَةَ فَاسْتَقْبِلُوهَا فَتَوَجَّهُوا إِلَى الْكَعْبَةِ  


See similar narrations below:

Collected by Bukhārī, Aḥmad
bukhari:4490Khālid b. Makhlad > Sulaymān > ʿAbdullāh b. Dīnār > Ibn

While some people were offering morning prayer at Quba' a man came to them and said, "A Qur'anic Order has been revealed to Messenger of Allah ﷺ tonight that he should face the Kaʿba at Mecca (in prayer), so you too should turn your faces towards it." At that moment their faces were towards Sham (i.e. Jerusalem) (and on hearing that) they turned towards the Kaʿba (at Mecca).  

البخاري:٤٤٩٠حَدَّثَنَا خَالِدُ بْنُ مَخْلَدٍ حَدَّثَنَا سُلَيْمَانُ حَدَّثَنِي عَبْدُ اللَّهِ بْنُ دِينَارٍ عَنِ ابْنِ عُمَرَ ؓ بَيْنَمَا النَّاسُ فِي الصُّبْحِ بِقُبَاءٍ جَاءَهُمْ رَجُلٌ فَقَالَ

إِنَّ رَسُولَ اللَّهِ ﷺ قَدْ أُنْزِلَ عَلَيْهِ اللَّيْلَةَ قُرْآنٌ وَأُمِرَ أَنْ يَسْتَقْبِلَ الْكَعْبَةَ أَلاَ فَاسْتَقْبِلُوهَا وَكَانَ وَجْهُ النَّاسِ إِلَى الشَّأْمِ فَاسْتَدَارُوا بِوُجُوهِهِمْ إِلَى الْكَعْبَةِ  

ahmad:4642Yaḥyá b. Saʿīd > Sufyān > ʿAbdullāh b. Dīnār > Ibn ʿUmar

[Machine] Indeed, the Messenger of Allah ﷺ has been sent down with the Quran tonight and he has been commanded to face the Kaaba, so face it and circle around it, directing yourselves towards the Kaaba.  

أحمد:٤٦٤٢حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ عَنْ سُفْيَانَ حَدَّثَنِي عَبْدُ اللهِ بْنُ دِينَارٍ سَمِعْتُ ابْنَ عُمَرَ يَقُولُ بَيْنَمَا النَّاسُ يُصَلُّونَ فِي مَسْجِدِ قُبَاءَ الْغَدَاةَ إِذْ جَاءَ جَاءٍ فَقَالَ

إِنَّ رَسُولَ اللهِ ﷺ قَدْ أُنْزِلَ عَلَيْهِ اللَّيْلَةَ قُرْآنٌ وَأُمِرَ أَنْ تُسْتَقْبَلَ الْكَعْبَةُ فَاسْتَقْبَلُوهَا وَاسْتَدَارُوا فَتَوَجَّهُوا نَحْوَ الْكَعْبَةِ