Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:2:234

And those who are taken in death among you and leave wives behind - they, ˹the wives, shall˺ wait four months and ten ˹days˺. And when they have fulfilled their term, then there is no blame upon you for what they do with themselves in an acceptable manner. And Allah is ˹fully˺ Acquainted with what you do.  

And those of you who pass away, die, leaving, behind, wives, they shall wait by themselves, after their death, refraining from marriage, for four months and ten, nights: this applies to women who are not pregnant. The waiting period in the case of pregnant women is for them to give birth — as stated by a verse in sūrat al-Talāq ˹Q. 65:4˺. The slavegirl must wait for half this period ˹of four months˺ according to the Sunna; when they have reached, completed, their term, of waiting, then you would not be at fault, O guardians, regarding what they may do with themselves, in the way of adorning themselves and offering themselves before suitors, honourably, in accordance with the Law; God is aware of what you do, both secretly and openly.
القرآن:٢:٢٣٤

وَالَّذِينَ يُتَوَفَّوْنَ مِنْكُمْ وَيَذَرُونَ أَزْوَاجًا يَتَرَبَّصْنَ بِأَنْفُسِهِنَّ أَرْبَعَةَ أَشْهُرٍ وَعَشْرًا ۖ فَإِذَا بَلَغْنَ أَجَلَهُنَّ فَلَا جُنَاحَ عَلَيْكُمْ فِيمَا فَعَلْنَ فِي أَنْفُسِهِنَّ بِالْمَعْرُوفِ ۗ وَاللَّهُ بِمَا تَعْمَلُونَ خَبِيرٌ  

{والذين يتوفون} يموتون {منكم ويذرون} يتركون {أزواجا يتربصن} أي ليتربصن {بأنفسهن} بعدهم عن النكاح {أربعة أشهر وعشرا} من الليالي وهذا في غير الحوامل أما الحوامل فعدتهن أن يضعن حملهن بآية الطلاق والأمة على النصف من ذلك بالسنة {فإذا بلغن أجلهن} انقضت مدة تربصهن {فلا جناح عليكم} أيها الاولياء {فيما فعلن في أنفسهن} من التزين والتعرض للخطاب {بالمعروف} شرعا {والله بما تعملون خبير} عالم بباطنه كظاهره.