I do not think that you should have to ask to use the restroom.
Rules:
1st Round is acceptance.
2nd Round is Points.
3rd Round are rebuttals.
4th thank each other. No new rebuttals/points are to be made. Just close it and thank each other.

Round 2 Points:
Point 1: If you ask, then this gives the teacher the ability to say no. No one should have the power to decide if another human is allowed to perform a necessary bodily function or not.
Point 2: You don't always have time to ask. If it is an emergency, seconds can determine you make it in time.
Point 3: If teachers always allow the student to go, what is the point of asking? If the teacher doesn't, refer to point 1.

Point 1 - it's called respect, do you go to someone's house and then just go into their fridge because you are hungry, or thirsty? Do you just not show up for work because your ill, no you tell your boss that you are not coming in. In school, teachers govern over the kids, they teach and I believe they should be given some respect, you don't just start walking out because you need to go, if you do that it will be abused by other students.

Point 2 if it's an emergency, do you honestly think that the 3 seconds it takes to ask the teacher will make a difference if you have diarrhea, even if you didn't ask you still wouldn't make it down the hall to the bathroom if it was such a big emergency, otherwise I think you can hold it for an extra 5 seconds it takes to ask.

Point 3 again it comes down to showing respect, sure the teacher will say yes, but at least you are letting them know what you are doing, do you leave the house and not let your parents know where you are going, or other significant others in your household, no you let them know so they are aware what you are doing or where you are going. It's just common courtesy to let people know. According to your philosophy if I'm hungry I should just go and take food from others at lunch or just help myself to their car because I need to get somewhere fast, it's all about respect and communication.

The teacher is responsible for your well being while you are in school, so therefore all you have to do is ask/let them know what you are doing.