Al-Bara bin Azib narrated:
When Allah's Messener arrived in Al-Madinah, he faced Bait Al-Maqdis in Salat for sixteen or seventeen months. Allah's Messenger longed to face the direction of the Ka'bah, so Allah Most High revealed: Verily! We have seen the turning of your face towards the heaven. Surely We shall turn you o a Qiblah that shall please you. So turn your face in the direction of Al-Masjid Al-Haram.So he faced the Ka'bah, and he liked that. A man performed the Asr prayer with him, then passed by some of the Ansar who were bowing in Salat for Asr while facing Bait Al-Maqdis. He told them that he had faced the direction of the Ka'bah, so they changed (their direction) while they were bowing. [He said:] There are narrations on this topic from Ibn Umar, Ibn Abbas, Umarah bin Aws, Amr bin Awf Al-Muzani and Anas.