Is your girlfriend at state funded university or a private college?
First write down what the issuses are, apart from this exam, has she passed everything else? Read the course booklet, it should set out the rules for progression, retakes and appeals. Has she got any documented health grounds, supported by a doctor's letter. Has she achieved more than 80% attendance.
If the university is uk government funded, go with her to the department in the first instance, talk to the course director if possible. They will be in a much better position to discuss what the options are. If this does not resolve the issue. go to the international student office and see if they have any suggestions. She may be able to appeal to the university, but appeals are subject to deadlines. So do not delay.
If it is a private college, there should be process but they tend to be less flexible. It may be a question of paying to retake a term.
If she is unable to overturn the termination decision, she needs to look at other study options if she wants to continue her studies. She may be able to transfer to another university. But to do this she will need to apply for a new visa, satisfy the new financial requirements and be within the study time limits. She must also have had more than 80% attendance at her current institution to be considered for a transfer elsewhere.
If it becomes a UKBA matter, they are not that flexible, the rules will be applied and she would be best to leave if directed to do so. Overstaying is an automatic 1 year ban and there are very limited grounds to appeal, so she is unlikely to be successful.