اللَّهُ يَتَوَفَّى الْأَنفُسَ حِينَ مَوْتِهَا وَالَّتِي لَمْ تَمُتْ فِي مَنَامِهَا فَيُمْسِكُ الَّتِي قَضَىٰ عَلَيْهَا الْمَوْتَ وَيُرْسِلُ الْأُخْرَىٰ إِلَىٰ أَجَلٍ مُّسَمًّى إِنَّ فِي ذَٰلِكَ لَآيَاتٍ لِّقَوْمٍ يَتَفَكَّرُونَ
―Quran 39:42
God takes the souls of the dead and the souls of the living while they sleep- He keeps hold of those whose death He has ordained and sends the others back until their appointed time- there truly are signs in this for those who reflect.
وَمَا تَدْرِي نَفْسٌ بِأَيِّ أَرْضٍ تَمُوتُ
no soul knows in what land it will die.
— Quran 31:34