I start by telling my third grade students that I have to wait for break times to use the restroom so I think they can do it. The procedure is that students must use the restroom during their recess or lunch break, however if they can't wait they must be willing to owe 5 minutes of work at their recess or lunch time. I say, "If it's truly an emergency then you are more then happy to owe me work." I don't believe in idle detentions or time outs without tasks to complete so I have a basket of review work they can choose from. One side of a worksheet seems to fill the up the 5 minutes. Review work is a must because this should be a fairly easy task, not something they have never seen before or may need help with. They can even put it on a clipboard and take it out with them to recess, returning it at the end of the break time.
The procedure works like this: They signal for permission to use the restroom in sign language, I respond in sign language yes or no. During direct lecture (I'm making a highly valuable teaching point) I may signal for them to wait until I finish or if it's nearing break time they get a no. They are more likely to get a yes if it's independent work time or partner time and learn this pretty quickly because it is rehearsed and modeled. If the student gets a yes they go to the white board and write their student number under 'Owe 5.' They grab two place markers (plastic pooh character figurines) and quietly place one on their desk and one on a buddies desk, a person whom I signal is okay to take along. I do this because the buddy system is required at my school. (Another student can also signal to me quietly if they feel they have to go too and owe as well as be their buddy.) The person returns from the restroom, puts the place marker away then later on is responsible for grabbing work on their own to complete at their break. When they return from their break they must submit their work for approval, then they can erase their number from the board under 'Owe 5'.
This basket of work is easily filled by just printing a few extra sheets whenever you are already planning to print a class set of worksheets, then putting the leftovers in this basket after the lesson is done or homework has been completed. You can double their time if they take to long to return from the restroom. 10 minutes for 2 sides that need to be completed. You can also up the amount of worksheets owed, mid year if you feel students are taking advantage of the system or they enjoy one worksheet too much. Limited on copies? You could have them write down their basic math facts, spelling words, or have them summarize the main points of the lesson they just missed on a piece of paper.
Usually a reminder that they have to owe additional work if they miss class time halts most students from going and provides a choice for those who really do have to go. My motto is if you exchange work time for break time then you must owe some work during your break time. Besides they just missed out on crucial learning during those five minutes they were gone. Again students know the procedure and feel they have a choice. This creates buy into my system and no possible way for them to blame the teacher for not letting them go. This technique works like magic!!