How can she fly back if she is 9 months pregnant?
No one/pilot would risk that, as far as I am aware.
If there were a group of UK citizens, perhaps diplomats or ex-pat workers, in random country X, which suddenly fell into political chaos, the UK government would fly them out. In the limit, they'd fly them out using a C130 full of tough blokes with guns. And if some of them happened to be nine months pregnant or, indeed, in active labour, or bleeding from a large gunshot wound, or had a potential fatal and communicable disease, that would be just the sort of stuff that C130s full of tough blokes deal with. Military evacuation flights deal with what's in front of them, and they don't say "no, we'll leave you to the bad guys, because we don't fancy the risk".
Even if it weren't a C130 full of tough blokes, but were a civilian airliner chartered by the UK government to evacuate people from a country with a military coup in progress, they would evacuate people from a coup irrespective of their medical condition. There would be risks; those would be risks to deal with. We have air ambulances, we have flying operating theatres. Defence medicine can do this sort of shit, up to an including what amounts to flying ICUs.
Commercial airlines place limits on where they will operate, and whom they will carry, which military and government charters don't. If the UK government want to fly someone who is 9 months pregnant, they can do just that. Her problem is that the UK government would rather saw its metaphorical legs off than lift a finger to help her., so she's reliant on a commercial airline flying a 9 month pregnant woman out of a warzone. That's a harder problem.