Abdullah bin Umar reported,

While the people were at Quba performing the dawn prayer, someone came to them and said, "Quran has been revealed to the Messenger of Allah ﷺ tonight, and he has been commanded to face the Kaabah, so face it." Their faces had been toward Sham, so they turned toward the Kaabah.

Bukhari 403

Sahih

حدثنا عبد الله بن يوسف قال أخبرنا مالك بن أنس عن عبد الله بن دينار

عن عبد الله بن عمر قال

بينا الناس بقباء في صلاة الصبح إذ جاءهم آت فقال إن رسول الله ﷺ قد أنزل عليه الليلة قرآن وقد أمر أن يستقبل الكعبة فاستقبلوها وكانت وجوههم إلى الشأم فاستداروا إلى الكعبة

البخاري 403صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Prayer
Chapter
Qibla, and those who do not require repeating the prayer for one who forgot and prayed facing other than the qibla
Numbering
Darussalam 403
Bukhari 403