Are antifungal pills safe for pregnant women?

Depends on the med. That is a complex question as there are many different antifungal medications. Most are 'category b' which are safe in pregnancy. However; some are not suggested for nursing mothers' and some are 'category c'; which are considered unsafe in pregnancy. Discussing the choice of medications with an obstetrician; or a primary care physician is advised.
Pregnancy class C. Oral antifungal drugs are pregnancy class c. Unless absolutely necessary, your doctor will generally avoid prescribing it. Category c drugs show adverse affect on fetus in animal studies, but no adequate human studies showing adverse affects on human fetus. However, potential benefits may out way risks if need to be used during pregnancy.