Nafi' narrates from Abdullah bin Umar (may Allah be pleased with them both) that Ibn Umar (may Allah be pleased with them both) was asked about the woman who is pregnant and whose husband dies. Abdullah bin Umar (may Allah be pleased with them both) said: When she delivers her child, she has become lawful. A man of the Ansar informed him that Umar bin al-Khattab (may Allah be pleased with him) said: If she gives birth while her husband is still lying on the bed and has not been buried, she has become lawful, that is, her waiting period has ended; and Allah knows best.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العدد / 15476