grown men in the NFL have to provide uriine tests, and if those intrusive tests showed they used some perfectly legal over the counter medicines banned in their legal contract, they can also be out of a job. This has not been ruled illegal.
Also, we don't know the facts of this case. She might of inquired into maternity leave. They might of asked if she was pregnant, and she volunteered the info.