An interesting debate
Without looking at the nature of the medical problem we should remember that the issue here is that she is a senior officer in a pseudo-military organisation. She has a responsibility to her duties and the crew first and foremost. Anything medical that effects her ability to carry out those duties is a risk to 'the team' or 'the mission' and as such the CMO has the power to stop and minimise that risk.
Her CMO has advised her (not ordered) the best precautions in his opinion - and remember he is an expert in this specific field - and she is unwilling (in the book, when asked she chose WON'T over CAN'T) to take those precautions.
After her decision has been made (which she should be allowed to make from a moral perspective) the CMO has the choice to then make it an order or not, or to suggest a compromise - eg light duties.
If it's then an order she has two choices - accept the order, or resign. That's the nature of the establishment she is in.
If she was a civilian, the issues would be the same but her doctor could not take the same stance - eg her can't order her, and she can chose to do whatever she wants.
The fact it is a pregnancy/baby that's involved is not the issue IMO.