People will be resurrected upon their intentions
Messenger of Allah ﷺ said, "An army will invade the Kaʿba and when the invaders reach al-Baidāʾ, all the ground will sink and swallow the whole army." I said, "O Messenger of Allah ﷺ! How will they sink into the ground while amongst them will be their markets (the people who worked in business and not invaders) and the people not belonging to them?" The Prophet ﷺ replied, "all of those people will sink but they will be resurrected and judged according to their intentions."
قَالَ رَسُولُ اللَّهِ ﷺ: «يَغْزُو جَيْشٌ الْكَعْبَةَ فَإِذَا كَانُوا بِبَيْدَاءَ مِنَ الأَرْضِ، يُخْسَفُ بِأَوَّلِهِمْ وَآخِرِهِمْ۔» قَالَتْ قُلْتُ: يَا رَسُولَ اللَّهِ كَيْفَ يُخْسَفُ بِأَوَّلِهِمْ وَآخِرِهِمْ وَفِيهِمْ أَسْوَاقُهُمْ؟ وَمَنْ لَيْسَ مِنْهُمْ؟ قَالَ: «يُخْسَفُ بِأَوَّلِهِمْ وَآخِرِهِمْ ثُمَّ يُبْعَثُونَ عَلَى نِيَّاتِهِمْ۔»