The Book of Visiting the Sick
كتاب عيادة المريض وتشييع الميت والصلاة عليه وحضور دفنه
Chapter 21: Superiority of one who is Bereaved of his Infants
The Messenger of Allah (ﷺ) said, "A Muslim whose three children die (in infancy) will not be touched by the Fire (of Hell) except for the fulfillment of Allah's Oath."[Al-Bukhari and Muslim].[Allah's Oath here refers to His Ayah: "There is not one of you but will cross over it (Hell)." (19:71) And the crossing will be across the 'Bridge' set over the Hell.]
A woman came to the Messenger of Allah (ﷺ) and said: "O Messenger of Allah! Only men benefit from your talks, so please fix a day for us, to teach us the knowledge which Allah has taught you." The Messenger of Allah (ﷺ) fixed a day and directed them to assemble. When they gathered, the Prophet (ﷺ) went to them and taught them what Allah had taught him. He (ﷺ) then said, "Any woman of you whose three children die (in infancy) they will be a guard for her against Fire (of Hell)." One of the women asked: "What if she loses two?" The Messenger of Allah (ﷺ) replied, "Even two."[Al-Bukhari and Muslim].
Chapter 22: Weeping while Passing by the Graves of the Dhalimin
Ibn `Umar (May Allah be pleased with them) reported: When the Messenger of Allah (ﷺ) and his Companions reached Al-Hijr, the dwellings of the Thamud people, he admonished his Companions (saying), "Do not pass by these people who are being tormented, without weeping, lest the punishment should befall you as it had befallen them."
[Al-Bukhari and Muslim].