My 6 year old ds is chronically constipated. But because he had stuff coming out, I had no idea it was even possible :/ so I completely understand your frustration.
DS is in year 1 at school. He had big issues last year in pre primary (first year full time), but our school dealt with it & did whatever was needed. If he needed a change at school, they'd actually meet me outside to avoid embarrassment & they'd clean him up & deal with it. I wasn't once asked to take him home, or even deal with anything more than his clothes in a plastic bag when he got home.
I will be forever grateful for their discretion & encouragement. I'd be quite disappointed if he was excluded for a medical condition.