Short answer
Yes, as far as pregnancy goes. Islam has no rule against a pregnant woman attending a janazah, visiting the bereaved or going out during an eclipse. Those beliefs are cultural superstitions. The normal rules for women at funerals and graves apply to her as to any woman, and she should look after her health.
Pregnancy adds no restriction on funerals, condolence visits or graveyards. The general Hanafi rulings for women apply: giving condolences is sunnah, women following the bier to the grave is makruh, and visiting graves is permitted for women who avoid wailing. Believing that such things harm the unborn child is a baseless superstition.
The four schools agree on this.
Explanation
In many cultures pregnant women are told to avoid funerals, graveyards, eclipses, cutting things or looking at certain people, for fear of harming the baby. None of this comes from the Quran or the sunnah. The Prophet ﷺ rejected the belief that such things are omens, saying there is no tiyarah (evil omen).
During an eclipse, which many cultures fear for pregnant women, the Prophet ﷺ taught that the sun and moon are two signs of Allah that do not eclipse for anyone's death or life, and told people to pray, make dua and give charity. A pregnant woman is included in that call, not shut out of it.
What does apply to her, as to every woman:
- Condolences: visiting and comforting the family is sunnah.
- The janazah prayer: see can women attend a janazah.
- Following the bier to the grave: disliked for women in the Hanafi school.
- Visiting graves: permitted when she avoids wailing; see can women visit graves.
- Her health: grief, crowds, long standing and heat are real concerns. She may sit, rest or leave early.
If an elder insists on an old custom, explain gently that only Allah decides what happens to the baby, and that trusting Him is the real protection. For good practice during pregnancy, see what Islam says about pregnancy.
The evidence
Quran, Surah At-Taghaabun 64:11
مَآ أَصَابَ مِن مُّصِيبَةٍ إِلَّا بِإِذْنِ ٱللَّهِ ۗ وَمَن يُؤْمِنۢ بِٱللَّهِ يَهْدِ قَلْبَهُۥ ۚ وَٱللَّهُ بِكُلِّ شَىْءٍ عَلِيمٌۭ ﴿١١﴾
No disaster strikes except by permission of Allah. And whoever believes in Allah - He will guide his heart. And Allah is Knowing of all things.
Harm comes only by Allah's decree, not through omens.
Sahih al-Bukhari 1044
Sahih... لا ينخسفان لموت أحد ولا لحياته ...
"They do not eclipse for the death or life of anyone."
Eclipses carry no omen for people, including the unborn.
Sahih al-Bukhari 5707
Sahih... لا عدوى ولا طيرة ...
"There is no contagion by itself and no evil omen."
Superstitions about bad luck have no basis.
Where the ruling is recorded
- al-Durr al-Mukhtar, Kitab al-Salah, chapter on funerals. Women following the funeral procession is disliked.
- Radd al-Muhtar (Ibn Abidin), Kitab al-Salah, chapter on funerals, visiting graves. Visiting graves is permitted for women on the sound view when free of wailing and impropriety.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.