Sunan an-Nasa'i, Book 27, Hadith 122 (In-Book) ⓘ
It was narrated that Abu Salamah said: "Ibn 'Abbas and Abu Hurairah were asked about the woman whose husband dies when she is pregnant. Ibn 'Abbas said: '(She should wait) for the longer of the two periods.' Abu Hurairah said: 'When she gives birth it becomes permissible for her to marry.' Abu Salamah went to Umm Salamah and asked her about that, and she said: 'Subai'ah Al-Aslamiyyah gave birth half a month after her husband died, and two men proposed to her. One was young and one was old, and she was inclined toward the young one. So the old one said: It is not permissible for you to marry. Her family was not there, and he hoped that if he went to her family they would marry her to him. She went to the Messenger of Allah and he said: It is permissible for you to marry, so marry whomever you want.'"
أَخْبَرَنَا مُحَمَّدُ بْنُ سَلَمَةَ، وَالْحَارِثُ بْنُ مِسْكِينٍ، قِرَاءَةً عَلَيْهِ وَأَنَا أَسْمَعُ، - وَاللَّفْظُ لِمُحَمَّدٍ - قَالَ أَنْبَأَنَا ابْنُ الْقَاسِمِ، عَنْ مَالِكٍ، عَنْ عَبْدِ رَبِّهِ بْنِ سَعِيدٍ، عَنْ أَبِي سَلَمَةَ، قَالَ سُئِلَ ابْنُ عَبَّاسٍ وَأَبُو هُرَيْرَةَ عَنِ الْمُتَوَفَّى، عَنْهَا زَوْجُهَا وَهِيَ حَامِلٌ قَالَ ابْنُ عَبَّاسٍ آخِرُ الأَجَلَيْنِ . وَقَالَ أَبُو هُرَيْرَةَ إِذَا وَلَدَتْ فَقَدْ حَلَّتْ . فَدَخَلَ أَبُو سَلَمَةَ إِلَى أُمِّ سَلَمَةَ فَسَأَلَهَا عَنْ ذَلِكَ، فَقَالَتْ وَلَدَتْ سُبَيْعَةُ الأَسْلَمِيَّةُ بَعْدَ وَفَاةِ زَوْجِهَا بِنِصْفِ شَهْرٍ فَخَطَبَهَا رَجُلاَنِ أَحَدُهُمَا شَابٌّ وَالآخَرُ كَهْلٌ فَحَطَّتْ إِلَى الشَّابِّ فَقَالَ الْكَهْلُ لَمْ تَحْلِلْ . وَكَانَ أَهْلُهَا غُيَّبًا فَرَجَا إِذَا جَاءَ أَهْلُهَا أَنْ يُؤْثِرُوهُ بِهَا فَجَاءَتْ رَسُولَ اللَّهِ صلى الله عليه وسلم فَقَالَ " قَدْ حَلَلْتِ فَانْكِحِي مَنْ شِئْتِ " .
also referenced under: Hadith 3510 (Reference) & Volume 4, Book 27, Hadith 3540 (DarusSalam)