Sunan Abi Dawud, Hadith 4289

Umm salamah reported the Prophet as saying about the swallowing up an army by the earth. I asked: How will a man who comes against his will (be swallowed up by the earth), Messenger of Allah ? He replied: All will be swallowed up, but each will be raised according to his intention on the Day of Resurrection.

حَدَّثَنَا عُثْمَانُ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا جَرِيرٌ، عَنْ عَبْدِ الْعَزِيزِ بْنِ رُفَيْعٍ، عَنْ عُبَيْدِ اللَّهِ ابْنِ الْقِبْطِيَّةِ، عَنْ أُمِّ سَلَمَةَ، عَنِ النَّبِيِّ صلى الله عليه وسلم بِقِصَّةِ جَيْشِ الْخَسْفِ قُلْتُ يَا رَسُولَ اللَّهِ فَكَيْفَ بِمَنْ كَانَ كَارِهًا قَالَ ‏ "‏ يُخْسَفُ بِهِمْ وَلَكِنْ يُبْعَثُ يَوْمَ الْقِيَامَةِ عَلَى نِيَّتِهِ ‏" ‏ ‏.‏

sunnah.com

also referenced under: Hadith 4276 (Hasan)