(I'm a university lecturer, and deputy exams officer in my department). Mitigating circumstances and special consideration are not just given for medical conditions, they may be given for other exceptional circumstances as well (e.g. death in the family). Examinations officers also usually have quite a bit of leeway, and I would suggest being 39 weeks pregnant is definitely grounds for you to be permitted to sit the exam in a separate room, with the clock stopped during loo breaks.
Your university have responsibilities to you under equality and diversity legislation as well as health and safety. Not allowing you extra time for frequent loo visits could give you a UTI, which could affect your labour and the health of your unborn child. You have a serious case for contesting their refusal to give you extra time.
Take this up again with your examinations officer. Get your GP to write you a letter stating that on medical grounds you need extra time to allow for loo breaks. If your exams officer still says no, you need to tell them you will be taking this higher.
Your department, or above that your school or faculty, should have an equality and diversity officer, and there may be an examinations board at a higher level than your department as well. You should talk to them about your department's refusal to give you extra time. If possible, get the equality and diversity officer or the women's officer of your local branch of the National Union of Students to advise you, and/or Student Welfare.
Your department is completely out of line on this.