It is narrated from Nafi‘ that Ibn ‘Umar (may Allah be pleased with them) was asked about a woman whose husband has died and she is pregnant. Ibn ‘Umar (may Allah be pleased with them) said: When she gives birth, her ‘iddah will end. An Ansari man informed him that ‘Umar ibn al-Khattab (may Allah be pleased with him) said: If a woman gives birth while her husband is still on the bed, not yet buried, even then her ‘iddah has ended.
Hadith Referenceمسند الإمام الشافعي / كتاب العدد والسكنى والنفقات / 1304
Hadith Takhrijصحیح : اخرجه البيهقي : 7 /430 - وفى المعرفة السنن والآثار له (4649) - ومالك في الموطأ، الطلاق، باب عدة المتوفى عنها زوجها اذا كانت حاملاً۔