It is understandably considered unethical to carry out drug safety research on pregnant mothers due to the risk to the child, so almost all medicines are considered unsafe as there is no ethical way to prove otherwise.
Usually you'd gather data from subjects that broke the rules anyways, just like how we gather info about illicit substances or gunshot wounds. Just because you're not supposed to drink alcohol during pregnancy doesn't mean we have any shortage of data about it.