not that simple
her goal is not simply work till the due date, but to be able to go back and work after her maternity leave.
imagine if you have to take a short-term disability for 3 month, and ask your boss' opinion see if it is work-related.
if her position is filled during maternity leave, her chances of being able to go back largely depends on her relationship with her manager. her manager needs to reserve a spot for her. this is very much work-related.