Abdullah bin Abbas reported,

The Messenger of Allah ﷺ used to pray while in Mecca facing Bayt al-Maqdis, with the Kaabah between him and his direction of prayer. After he migrated to Medina, he continued doing so for sixteen months, then he was turned to face the Kaabah.

Azami 1926

Sahih

عن ابن عباس قال

كان رسول الله ﷺ يصلي وهو بمكة نحو بيت المقدس، والكعبة بين يديه، وبعدما هاجر إلى المدينة ستة عشر شهرا، ثم صرف إلى الكعبة.

الأعظمي 1926صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
Description of prayer, the takbir, standing, and recitation
Section
Changing the qibla from Bayt al-Maqdis to the Sacred House of Allah
Numbering
Jami al-Kamil 1926 (2nd edition)
Azami 1926