The Torah prohibits male Kohanim from becoming Tameh (impure) through contact with corpses. The Poskim discuss whether the wife of a Kohen who is pregnant must also refrain from entering a cemetery, since her unborn child may be a male.
The Rokeach (R. Elazar ben Yehuda, 1176–1238 of Worms) is lenient on this question, because of a Safek Safeka (double doubt): It is possible the embryo will not even be viable, and even if it is viable, perhaps it is female. Therefore, they may conduct themselves as normal.
The question then becomes whether she may give birth in a hospital in which there may be Tuma’at Met (impurity of corpses). If the baby is a boy, he must immediately be protected from Tumah. Because of this problem, Rav Elyashiv ruled that a wife of a Kohen should do an ultrasound to determine the gender. If, in fact, the unborn baby is a boy, she should arrange to give birth in a hospital in which there is no potential Tuma’at Met.
This had been the accepted ruling in an earlier Daily Halacha. At the time, Hacham Ovadia had not yet issued an opinion. However, recently Hacham Ovadia’s Halachot of Avelut (Vol. 2) were published, and there he deals with this question. His conclusion is to be lenient and not require determining the gender. That way the "Safek Safeka" still applies, and she may go to a regular hospital because of the double doubt. There is no obligation to clarify the double doubt, especially since the ultrasound is not always accurate, as brought by Rav Fischer in his ruling. However, once the baby is born, if it is a boy, the parents are obligated to be careful that he is not exposed to Tumah.
SUMMARY
A wife of a Kohen who is pregnant may become Tameh (impure) to corpses, and she may give birth in a regular hospital. If the baby is male, the parents must immediately insure that he is not exposed to Tumah.