I heard from Anas a narration like this from the Messenger of Allah (ﷺ).
Sahih Muslim Book 5, Hadith 15
← Previous Hadith
The Messenger of Allah (ﷺ) used to pray in the folds of the sheep and goats before the mosque was built.
Sahih Muslim Book 5, Hadith 14 Next Hadith → I said prayer with the Apostle (ﷺ) turning towards Bait-ul-Maqdis for sixteen months till this verse of Surah Baqara wis revealed:" And wherever you are turn your faces towards it" (ii. 144). This verse was revealed when the Apostle (ﷺ) had said prayer. A person amongst his people passed by the people of Ansar as they were engaged in prayer. He narrated to them (this command of Allah) and they turned their faces towards the Ka'ba.
Sahih Muslim Book 5, Hadith 16
Sahih Muslim Book 5, Hadith 14 Next Hadith → I said prayer with the Apostle (ﷺ) turning towards Bait-ul-Maqdis for sixteen months till this verse of Surah Baqara wis revealed:" And wherever you are turn your faces towards it" (ii. 144). This verse was revealed when the Apostle (ﷺ) had said prayer. A person amongst his people passed by the people of Ansar as they were engaged in prayer. He narrated to them (this command of Allah) and they turned their faces towards the Ka'ba.
Sahih Muslim Book 5, Hadith 16