Jami` at-Tirmidhi, Book 47, Hadith 3227 (In-Book) ⓘ
Narrated Ibn 'Abbas: "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)"
حَدَّثَنَا هَنَّادٌ، وَأَبُو عَمَّارٍ قَالاَ حَدَّثَنَا وَكِيعٌ، عَنْ إِسْرَائِيلَ، عَنْ سِمَاكٍ، عَنْ عِكْرِمَةَ، عَنِ ابْنِ عَبَّاسٍ، قَالَ لَمَّا وُجِّهَ النَّبِيُّ صلى الله عليه وسلم إِلَى الْكَعْبَةِ قَالُوا يَا رَسُولَ اللَّهِ كَيْفَ بِإِخْوَانِنَا الَّذِينَ مَاتُوا وَهُمْ يُصَلُّونَ إِلَى بَيْتِ الْمَقْدِسِ فَأَنْزَلَ اللَّهُ: (وَمَا كَانَ اللَّهُ لِيُضِيعَ إِيمَانَكُمْ ) الآيَةَ . قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ حَسَنٌ صَحِيحٌ .
also referenced under: Hadith 2964 (Reference) & Volume 5, Book 44, Hadith 2964 (DarusSalam)