Sayyidna Bara ibn Aazib (RA) said that when the Prophet (SAW) came to Madinah, he continued to face the direction of Bayt al Maqdis in prayer for sixteen or seventeen months. He longed to turn to the ka’bah. So, Allah, the Exalted, revealed (the verse):
So, he turned his face towards the Ka’bah, and he loved that. A man prayed with him the asr prayer and then passed by a section of the Ansar people while they were in ruku of the salah of asr facing Bayt al-Maqdis. So, he said, “He bears testimony that he prayed with Allah’s Messenger (SAW) and indeed he had faced the Kabah,” The narrator said, “They turned their direction while still in ruku. Hamad reported from Waki, from Sufyan, from Abdullah ibn Dinar that Sayyidina Ibn Umar (RA) said, ‘They were in ruku of the salah of fajr.’