Assuming your older DD is old enough to take herself to the toilet, you should have been positioned so you were primarily watching your younger DD. If they both require supervision, you should have booked them to swim at different times.
Your younger DD should have alerted her teacher she needed to go earlier and/or waited for you to take her, but children don't always realise they need the toilet with bags of time to spare.
I don't think your younger DD necessarily did anything wrong - if she thought she was going to run out of time, then far better to attempt to make it to the toilet than to wee herself in front of her classmates.
It's unfortunate no one was able to supervise her in time.
You said she was distressed in the toilets - I assume it's because she didn't make it on time, even though she left by herself? In which case, even if you had been sat near her, watching like a hawk, you might not have been able to supervise in time either, so she would have still been distressed.
The bit that's gone wrong is the teacher not knowing where all the pupils are at any one time. In an ideal world, if it's the sort of swim class where the teacher gets into the water with the kids, you'd have both a separate lifeguard keeping an eye on the pool, and an assistant keeping an eye on the 'land', to watch out for children wandering off. However, it seems as if they've outsourced this assistant role to the parents, and you've all agreed that's fine.
So... what would I expect to happen?
Probably a ban on multiple siblings swimming unless there is at least one parent/responsible adult spectating for each. A bit shit, but practically, I can't think of anything else they can do.