It's a complete nightmare to be honest and there are no right answers.
There is a VAST amount of lost learning in my school due to studens leaving lessons to go to the toilet. A significant number of students ask to go every single lesson without fail. Depending where their classroom is, this can mean they are missing ten minutes of five lessons a day. Fifty minutes lost learning each day for these kids.
Plus the high number of kids at large, unsupervised in the corridors leads to all sorts of problems as you can imagine.
The constant ingress and egress of kids in lessons obviously disrupts the flow to some extent also - not the end of the world, but it is annoying to a degree.
HOWEVER, for the reasons you state - stomach upsets, periods etc, it is not humane to flatly ban toilet visits.
Generally we try to "use our judgement". I err on the side of letting people go, because I obviously I would hate for a student to wet themselves in class, have a leak or similar.
Other more hardkine colleagues generally say no.
I am sure we all get it wrong sometimes. I genuinely don't know the answer. I think so much of it is down to phone addiction - I think students are desperate to check their phones, and that's why they ask to go all the time. And a lot of them also are just bored and fancy a walk, want to see who else is out of lessons and on the corridor etc. It's an epidemic!
Anyway, to solve the immediate problem, send your child in tomorrow with a handwritten note by yourself, either ring her planner or on a piece of paper, saying that while you are awaiting a toilet pass she needs to ve allowed to go as there is a genuine medical need. I don't know any teachers that would ignore a note from a parent like this.