كتاب الأيمان
27  
The Book of Oaths
(7)
Chapter: The vow of a disbeliever, and what he should do about it if he becomes a muslim
(7)
باب نَذْرِ الْكَافِرِ وَمَا يَفْعَلُ فِيهِ إِذَا أَسْلَمَ ‏‏
Sahih Muslim 1656 c

'Abdullah b. 'Umar reported that 'Umar b. Khattab asked the Messenger of Allah (ﷺ) as he was at ji'rana (a town near Mecca) on his way back from Ta'if:

Messenger of Allah, I had taken a vow during the days of Ignorance that I would observe I'tikaf for one day in the Sacred Mosque. So what is your opinion? He said: Go and observe I'tikaf for a day. And Allah's Messenger (ﷺ) gave him a slave girl out of the one-fifth (of the spoils of war meant for the Holy Prophet). And when Allah's Messenger (inay peace be upon him) set the war prisoners free. 'Umar b. Khattab heard their voice as they were saying: Allah's Messenger (ﷺ) has set as free. He (Hadrat 'Umar) said: What is this? They said: Allah's Messenger (ﷺ) has set free the prisoners of war (which had fallen to the lot of people). Thereupon he (Hadrat 'Umar) said: Abdullah, go to that slave-girl and set her free.
وَحَدَّثَنِي أَبُو الطَّاهِرِ، أَخْبَرَنَا عَبْدُ اللَّهِ بْنُ وَهْبٍ، حَدَّثَنَا جَرِيرُ بْنُ حَازِمٍ، أَنَّ أَيُّوبَ، حَدَّثَهُ أَنَّ نَافِعًا حَدَّثَهُ أَنَّ عَبْدَ اللَّهِ بْنَ عُمَرَ حَدَّثَهُ أَنَّ عُمَرَ بْنَ الْخَطَّابِ سَأَلَ رَسُولَ اللَّهِ صلى الله عليه وسلم وَهُوَ بِالْجِعْرَانَةِ بَعْدَ أَنْ رَجَعَ مِنَ الطَّائِفِ فَقَالَ يَا رَسُولَ اللَّهِ إِنِّي نَذَرْتُ فِي الْجَاهِلِيَّةِ أَنْ أَعْتَكِفَ يَوْمًا فِي الْمَسْجِدِ الْحَرَامِ فَكَيْفَ تَرَى قَالَ ‏ "‏ اذْهَبْ فَاعْتَكِفْ يَوْمًا ‏"‏ ‏.‏ قَالَ وَكَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم قَدْ أَعْطَاهُ جَارِيَةً مِنَ الْخُمْسِ فَلَمَّا أَعْتَقَ رَسُولُ اللَّهِ صلى الله عليه وسلم سَبَايَا النَّاسِ سَمِعَ عُمَرُ بْنُ الْخَطَّابِ أَصْوَاتَهُمْ يَقُولُونَ أَعْتَقَنَا رَسُولُ اللَّهِ صلى الله عليه وسلم ‏.‏ فَقَالَ مَا هَذَا فَقَالُوا أَعْتَقَ رَسُولُ اللَّهِ صلى الله عليه وسلم سَبَايَا النَّاسِ ‏.‏ فَقَالَ عُمَرُ يَا عَبْدَ اللَّهِ اذْهَبْ إِلَى تِلْكَ الْجَارِيَةِ فَخَلِّ سَبِيلَهَا ‏.‏
Reference : Sahih Muslim 1656c
In-book reference : Book 27, Hadith 41
USC-MSA web (English) reference : Book 15, Hadith 4074
  (deprecated numbering scheme)