Sahih Bukhari | Volume 1 | Hadith Number 392
Narrated by ' bin 'Azib
Allah's Apostle prayed facing Baitul-Maqdis for sixteen or seventeen months but he loved to face the Ka'ba (at Mecca) so Allah revealed: "Verily, We have seen the turning of your face to the heaven!" (2:144) So the Prophet faced the Ka'ba and the fools amongst the people namely "the Jews" said, "What has turned them from their Qibla (Bait-ul-Maqdis) which they formerly observed"" (Allah revealed): "Say: 'To Allah belongs the East and the West. He guides whom he will to a straight path'." (2:142) A man prayed with the Prophet (facing the Ka'ba) and went out. He saw some of the Ansar praying the 'Asr prayer with their faces towards Bait-ul-Maqdis, he said, "I bear witness that I prayed with Allah's Apostle facing the Ka'ba." So all the people turned their faces towards the Ka'ba.