(a) It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the first thing abrogated from the Qur'an was the verse of the qiblah, namely: "To Allah belong the east and the west; wherever you turn, there is Allah" [Surah al-Baqarah: 115]. So the Messenger of Allah (peace and blessings be upon him) began to pray facing Bayt al-Maqdis and left the House of Allah. Then this verse was revealed: "The foolish among the people will say: What has turned them away from the qiblah they used to face?" [Surah al-Baqarah: 142], meaning Bayt al-Maqdis. Allah Almighty abrogated it and turned him (peace and blessings be upon him) toward the Ancient House, that is, the Ka'bah. In this regard this verse was revealed: "And from wherever you go out, turn your face toward al-Masjid al-Haram; and wherever you are, turn your faces toward it (al-Masjid al-Haram)" [Surah al-Baqarah: 150].
(b) Imam al-Shafi'i (may Allah have mercy on him) explained this narration in detail: when the Messenger of Allah (peace and blessings be upon him) emigrated to Madinah, he began to pray facing Bayt al-Maqdis, but he (peace and blessings be upon him) wished that the qiblah would be the House of Allah. So Allah Almighty revealed this verse: "We see the turning of your face toward the heaven" [Surah al-Baqarah: 144].
(c) Imam al-Bayhaqi (may Allah have mercy on him) says that it is reported from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that this verse was revealed concerning the statement the Jews made, namely: "What has turned them away from the qiblah they used to face?" [Surah al-Baqarah: 142].
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2245