Sahih al-Bukhari — Hadith 4289 (KitabGrid sequence)
Narrated Ibn `Umar:
حَدَّثَنَا خَالِدُ بۡنُ مَخۡلَدٍ، حَدَّثَنَا سُلَيۡمَانُ، حَدَّثَنِي عَبۡدُ اللَّهِ بۡنُ دِينَارٍ، عَنِ ابۡنِ عُمَرَ ـ رضى الله عنهما ـ بَيۡنَمَا النَّاسُ فِي الصُّبۡحِ بِقُبَاءٍ جَاءَهُمۡ رَجُلٌ فَقَالَ إِنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَدۡ أُنۡزِلَ عَلَيۡهِ اللَّيۡلَةَ قُرۡآنٌ، وَأُمِرَ أَنۡ يَسۡتَقۡبِلَ الۡكَعۡبَةَ أَلاَ فَاسۡتَقۡبِلُوهَا. وَكَانَ وَجۡهُ النَّاسِ إِلَى الشَّأۡمِ فَاسۡتَدَارُوا بِوُجُوهِهِمۡ إِلَى الۡكَعۡبَةِ.
Translation
Khalid ibn Makhlad narrated to us; Sulayman narrated to us; Abdullah ibn Dinar narrated to me, from Ibn Umar رضي الله تعالى عنهما:
While the people were at the dawn prayer in Quba', a man came to them and said, “Quran was revealed to the Messenger of Allah صلى الله عليه وآله وسلم tonight, and he was commanded to face the Ka'bah. So face it.” The people had been facing al-Sham, so they turned their faces toward the Ka'bah.