Ideally, all medications (including over-the-counter medications) should be avoided during pregnancy. Some drugs can hurt the developing baby. However, there are some medications that are considered safe to take during pregnancy and that might help you sleep better. Always talk to your doctor before taking any kinds of drugs. This includes over-the-counter drugs, herbs and dietary supplements.