Excellent question, although I am sorry to hear your daughter has been so upset. In short, here is what I would advise:
(1) Remain on the waiting list for counseling and take advantage of an opening when one comes up. A qualified child therapist is the best professional to deal with, as s/he will be able to fully evaluate the situation and treat appropriately.
(2) In the meantime... I think you can begin two parallel lines of treatment. First, this type of compulsion usually is triggered by some repetitive thoughts of losing control. In other words, she fears losing control so mightily that she is now bearing down and controlling the one thing she has absolute control over - which is her body and its functioning. To lessen the "urge," I would (again, this is a short run solution) offer to compromise some control back to her. Let her know that, even if in the middle of a lesson, she will be afforded the choice of going to the bathroom every (say,) 15 minutes. The time span can vary depending upon her need/wishes, but the point of the exercise is to ensure the control while also encouraging appropriate behavior. If she knows she will have the opportunity to escape the lesson, her urgency to grip the compulsion will (presumably) lessen.
(3) And finally, you can also speak with her pediatrician about the possibility of a low dose prescription of medicine to help loosen the anxiety. A medicine in the class of "SSRIs" can work with teenagers to help ease the biology of anxiety. Again, once the therapist takes over the case, s/he can assess the effectiveness, work directly with the pediatrician, and make sure your daughter receives a balanced, effective course of treatment.
I wish you well. These problems are not simple, as I am certain your daughter is remarkable embarrassed by her actions as well. If you are satisfied with the response, please hit "Accept." That is the only way I can receive credit for my answer. Thanks-