It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that when the command for changing the Qiblah was revealed, the people said: "O Messenger of Allah (peace and blessings be upon him)! What will happen to our companions who used to pray facing Bayt al-Maqdis and passed away in that state?" Upon this, the following verse was revealed: «﴿وَمَاكَانَاللّٰهُلِيُضِيعَإِيمَانَكُمْ﴾ [البقرة : 143]» "Allah will not let your prayers go to waste."
Hadith Referenceمسند احمد / ومن مسند بني هاشم / 3249
Hadith Gradingحکم دارالسلام:صحيح لغيره، وهذا إسناد ضعيف، رواية سماك عن عكرمة مضطربة