Narrated Muslim bin Yasar Al-Juhani: that 'Umar bin Al-Khattab was asked about this Ayah: And when your Lord brought forth from the Children of Adam, from their loins, their seed and made them testify as to themselves: Am I not your Lord? They said: Yes! We testify, lest you should say on the Day of Resurrection: 'Verily, we have been unaware of this (7:172).' So 'Umar bin Al-Khattab said: I heard the Messenger of Allah (ﷺ) being asked about it. So the Messenger of Allah (ﷺ) said: 'Indeed Allah created Adam, then He wiped his back with His Right Hand, and his offspring came out of him. So he said: I created these for Paradise, and they will do the deeds of the people of Paradise. Then He wiped his back, and his offspring came out of him. So He said: I created these for the Fire, and they will do the deeds of the people of the Fire. A man said: 'Then of what good is doing deeds O Messenger of Allah!' The Messenger of Allah (ﷺ) said: 'Verily, when Allah created a man for Paradise, He makes him perform the deeds of the people of Paradise, until he dies doing one of the deeds of the people of Paradise. So Allah will admit him into Paradise. And when He created a man for the Fire, He makes him perform the deeds of the people of the Fire until he dies doing the deeds of the people of the Fire. So Allah will enter him into the Fire.'

حَدَّثَنَا الْأَنْصَارِيُّ، حَدَّثَنَا مَعْنٌ، حَدَّثَنَا مَالِكُ بْنُ أَنَسٍ، عَنْ زَيْدِ ابْنِ أَبِي أُنَيْسَةَ، عَنْ عَبْدِ الْحَمِيدِ بْنِ عَبْدِ الرَّحْمَنِ بْنِ زَيْدِ بْنِ الْخَطَّابِ، عَنْ مُسْلِمِ بْنِ يَسَارٍ الْجُهَنِيِّ، أَنَّ عُمَرَ بْنَ الْخَطَّابِ سُئِلَ عَنْ هَذِهِ الْآيَةِ وَإِذْ أَخَذَ رَبُّكَ مِنْ بَنِي آدَمَ مِنْ ظُهُورِهِمْ ذُرِّيَّتَهُمْ وَأَشْهَدَهُمْ عَلَى أَنْفُسِهِمْ أَلَسْتُ بِرَبِّكُمْ قَالُوا بَلَى شَهِدْنَا أَنْ تَقُولُوا يَوْمَ الْقِيَامَةِ إِنَّا كُنَّا عَنْ هَذَا غَافِلِينَ سورة الأعراف آية 172، ‏‏‏‏‏‏فَقَالَ عُمَرُ بْنُ الْخَطَّابِ:‏‏‏‏ سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يُسْأَلُ عَنْهَا، ‏‏‏‏‏‏فَقَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ:‏‏‏‏ إِنَّ اللَّهَ خَلَقَ آدَمَ، ‏‏‏‏‏‏ثُمَّ مَسَحَ ظَهْرَهُ بِيَمِينِهِ، ‏‏‏‏‏‏فَاسْتَخْرَجَ مِنْهُ ذُرِّيَّةً، ‏‏‏‏‏‏فَقَالَ:‏‏‏‏ خَلَقْتُ هَؤُلَاءِ لِلْجَنَّةِ وَبِعَمَلِ أَهْلِ الْجَنَّةِ يَعْمَلُونَ، ‏‏‏‏‏‏ثُمَّ مَسَحَ ظَهْرَهُ فَاسْتَخْرَجَ مِنْهُ ذُرِّيَّةً، ‏‏‏‏‏‏فَقَالَ:‏‏‏‏ خَلَقْتُ هَؤُلَاءِ لِلنَّارِ وَبِعَمَلِ أَهْلِ النَّارِ يَعْمَلُونَ ، ‏‏‏‏‏‏فَقَالَ رَجُلٌ:‏‏‏‏ يَا رَسُولَ، ‏‏‏‏‏‏اللَّهِ فَفِيمَ الْعَمَلُ ؟ قَالَ:‏‏‏‏ فَقَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ:‏‏‏‏ إِنَّ اللَّهَ إِذَا خَلَقَ الْعَبْدَ لِلْجَنَّةِ اسْتَعْمَلَهُ بِعَمَلِ أَهْلِ الْجَنَّةِ حَتَّى يَمُوتَ عَلَى عَمَلٍ مِنْ أَعْمَالِ أَهْلِ الْجَنَّةِ فَيُدْخِلَهُ اللَّهُ الْجَنَّةَ، ‏‏‏‏‏‏وَإِذَا خَلَقَ الْعَبْدَ لِلنَّارِ اسْتَعْمَلَهُ بِعَمَلِ أَهْلِ النَّارِ حَتَّى يَمُوتَ عَلَى عَمَلٍ مِنْ أَعْمَالِ أَهْلِ النَّارِ فَيُدْخِلَهُ اللَّهُ النَّارَ ، ‏‏‏‏‏‏قَالَ أَبُو عِيسَى:‏‏‏‏ هَذَا حَدِيثٌ حَسَنٌ، ‏‏‏‏‏‏وَمُسْلِمُ بْنُ يَسَارٍ لَمْ يَسْمَعْ مِنْ عُمَرَ، ‏‏‏‏‏‏وَقَدْ ذَكَرَ بَعْضُهُمْ فِي هَذَا الْإِسْنَادِ بَيْنَ مُسْلِمِ بْنِ يَسَارٍ وَبَيْنَ عُمَرَ رَجُلًا مَجْهُولًا.

Explanation
تفسير الحديث

This hadith talks about the creation of Adam and the testimony of his offspring. It narrates that Allah took the progeny of Adam from his back and made them testify against themselves, asking: 'Am I not your Lord?' They responded: 'Yes, we bear witness.' This indicates that every human has an innate recognition of Allah's Lordship. The hadith further explains that when Allah created Adam, He wiped his back and extracted his offspring, choosing some for paradise and some for hell. The Prophet was asked about the role of actions, to which he explained that a person created for paradise will be guided to do the deeds of the people of paradise until they die, and they will enter paradise. Conversely, the one created for hell will do the deeds of the people of hell until they die and will end up in hell. In summary, this hadith illustrates the concept of predestination, where Allah knows what each person will do, but it does not absolve the individual of responsibility for their actions, as every person is invited to engage in righteous deeds and follow the path of guidance up until the last moments of their life.

هذا الحديث يتحدث عن قصة خلق الله لآدم وشهادة ذريته له. يروي الحديث أن الله سبحانه وتعالى أخذ ذرية آدم من صلبه وأشهدهم على أنفسهم، حيث سألهم: "ألستُ بربكم؟" فأجابوا: "بلى شهدنا"، وهذا يشير إلى أن كل إنسان لديه فطرة تعترف بربوبيته سبحانه. ثم يشرح الحديث كيف أن الله سبحانه وتعالى عندما خلق آدم، قام بمسح ظهره واستخرج ذريته، فاختار منهم من سيكون في الجنة ومن سيكون في النار. وقد سئل رسول الله عن دور الأعمال، فبين أن الشخص الذي خُلق للجنة سيقوم بأعمال أهل الجنة حتى يموت، فيدخل الجنة. أما الذي خُلق للنار فسوف يقوم بأعمال النار حتى يموت، فيدخل النار. الخلاصة أن هذا الحديث يُظهر قضية القضاء والقدر، حيث أن الله يعلم ما سيقوم به كل إنسان، ولكن هذا لا يعفي الإنسان من المسؤولة عن أفعاله، حيث يُدعى كل إنسان للعمل الصالح والسير في طريق الهداية، لأن العبرة هي في النية والعمل حتى آخر لحظة من الحياة.

Source: Jami' Al-Tirmidhi by Abu `Isa Muhammad at-Tirmidhi