"When the Prophet ﷺ began facing the Ka'bah they said: 'O Messenger of Allah! How about our brothers who died while they were praying toward Bait Al-Maqdis?' So Allah Most High revealed: Allah would not allow your faith to be wasted. (2:143)"
لَمَّا وُجِّهَ النَّبِيُّ ﷺ إِلَى الْكَعْبَةِ قَالُوا يَا رَسُولَ اللَّهِ كَيْفَ بِإِخْوَانِنَا الَّذِينَ مَاتُوا وَهُمْ يُصَلُّونَ إِلَى بَيْتِ الْمَقْدِسِ فَأَنْزَلَ اللَّهُ (وَمَا كَانَ اللَّهُ لِيُضِيعَ إِيمَانَكُمْ ) الآيَةَ