Sahih al-Bukhari 7252
Yahya (Balkhi) narrated to us that Waki' told us. He narrated from Isra'il, Isra'il from Abu Ishaq, and Abu Ishaq from Hazrat Bara (ra). He said: When the Messenger of Allah (saw) came to Medina, for sixteen or seventeen months he (saw) kept praying facing Jerusalem (Bait al-Maqdis), and he (saw) liked that the face should be turned towards the Ka'bah. So Allah, the Exalted, revealed (the verse): “Verily, We see thee turning thy face often to heaven; surely, then, will We make thee turn to the Qiblah which thou likest” (Qur’an 2:145). So he (saw) was ordered to turn his face towards the Ka'bah. And a man offered the Asr Prayer with him (saw), then he went out and passed by some people of the Ansar, and he said that he bore witness that he had prayed with the Prophet (saw) and that he (saw) had been ordered to turn his face towards the Ka'bah. (Hearing this) they turned round while they were bowing (ruku') in the Asr Prayer.
AI-translated by Islam-Today
Book 1: Acceptance of the information given by one truthful person in about all matters