This question already has an answer here:
By US federal law (or maybe regulation? not sure which) it is not allowed to use the bathroom or get out your seat while the seatbelt sign is lit.
Thank god, it has never happened to me, but what if there is a diarrhea emergency when the seatbelt sign is lit? Assume that the flight attendant tells me to "get back in my seat" if I rise to try to use the bathroom. In that situation should I just crap in the seat? My guess is that the neighboring passengers will not like flying for the next 6 hours smelling my diarrhea, and I certainly will not like sitting in my own diarrhea for 6 hours.
Note that this can be a concern especially when the plane is stuck on the taxiway. Sometimes, while waiting to takeoff, the plane can be stuck on the taxiway for 30 minutes or more.
The problem may also affect parents who are traveling with children.