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 is not one to waste your prayers."
Hadith Referenceمسند احمد / ومن مسند بني هاشم / 2964
Hadith Gradingحکم دارالسلام:صحيح لغيره، رواية سماك بن حرب عن عكرمة مضطربة