It is narrated from al-Bara' bin Azib (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) prayed facing Bayt al-Maqdis for sixteen or seventeen months. His heartfelt wish was that his qiblah would become the House of Allah. He led the 'Asr prayer (facing the Ka'bah). A man from among those who had prayed with him went out. He passed by a mosque where people were praying in congregation and were in the state of bowing, and he said: By Allah! I bear witness that I have prayed with the Messenger of Allah (peace and blessings be upon him) facing Makkah (the House of Allah). Hearing this, those people immediately turned round towards the House of Allah.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2191