How old is she and what grade???
Next: when I was in elementary school... my classmate had Kidney problems... due to holding it too often and too long and constantly. Once the kidneys are damaged, well, it is damaged.
Now, per my kids school They can go to the bathroom ANYTIME. Even if during a lesson. They can go. They just tell the teacher.
Now, maybe raising your hand to go to the bathroom is the problem. Because, a raised hand, can mean anything/a question/an interruption etc. SO, the Teacher may misinterpret a raised hand.
In my son's Kinder class, FOR bathroom needs, the children make a different hand gesture. They are taught.... to raise their hand use the American Sign language gesture for "bathroom."
THIS way, the teacher KNOWS darn well, a child has to go and pee and go to the bathroom. And the Teacher ALWAYS allows a child, to use the bathroom, anytime.
NOT allowing a child to go to the bathroom... is to me, very inappropriate.
I say: your daughter's Teacher really irks me and I would have told her... NO, my child will go to the bathroom when need be... or you will have an accident on your classroom floor.
It is a biological need.... which does not wait, for your timing.