If I was the judge, this would be the worst way to go. Because unless your going to the hospital for medical treatment, a medical defense for use of a toilet at home is gonna be a hard pill to swallow. How often do you think this kinda story gets sold to him doing traffic court.
Tickets are issues for breaking a rule, you broke the rule, you get the ticket. There is no rule that's says people can speed if ya might shit yourself.
Now, if you have a report from a medical professional with ibs, medication, this being something major from a doctor, in writing. Then it might help.
I listen to nothing but lawyer radio when I mill chips, and this question comes up weekly. I'm not even joking.... But generally the above advice is said everytime.