There are very few medications that should absolutely be avoided during pregnancy. One that should be avoided is the antibiotic tetracycline, which can permanently stain a developing baby's teeth. Certain anti-hypertensive (blood pressure) agents, in a class of drugs called ACE inhibitors, should be changed before you even attempt pregnancy. Most treatments for cancer are also incompatible with a healthy pregnancy.
Most prescription drugs fall into a category in which the risks of the medication must be balanced against the benefits of treating a medical condition. If you have a medical condition that requires treatment with a medication that has potential effects on the fetus, you definitely do need that consultation with your physician.