Abdullah bin Abbas reported,

When the Prophet ﷺ turned toward the Kaabah, the people asked, "Messenger of Allah, what about our brothers who died while praying toward Bayt al-Maqdis?" So Allah Most High revealed, "And Allah would never let your faith go to waste" [Baqarah 2:143].

Azami 11926

Hasan

عن ابن عباس قال

لما وجه النبي ﷺ إلى الكعبة قالوا: يا رسول الله! كيف بإخواننا الذين ماتوا وهم يصلون إلى بيت المقدس؟ فأنزل الله تعالى: {وما كان الله ليضيع إيمنكم}

الأعظمي 11926حسن
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Virtues of Surah Baqarah
Section
His saying, "The foolish among the people will say, 'What has turned them away from their qibla which they used to face?' Say, 'To Allah belongs the east and the Maghrib. He guides whom He wills to a straight path.' And thus We have made you a moderate nation that you will be witnesses over the people and the Messenger will be a witness over you. And We did not make the qibla which you used to face except that We might make evident who would follow the Messenger from who would turn back on his heels. And indeed, it was difficult except for those whom Allah has guided. And never would Allah cause your faith to be lost."
Numbering
Jami al-Kamil 11926 (2nd edition)
Azami 11926