I agree with this suggestion. There could be all manner of reasons why this has happened - physical, mental, behavioral, etc....
But it could be that he does not want to go in the school bathroom for some reason.
I was always homeschooled and, in any case, I have no problem taking care of my business in any public bathroom. I was surprised to learn that there are LOTS of people who refuse to go in public toilets and school toilets are often considered the worst. There are people who will only do their bowel movements at home.
That said, this did seem to come on quickly, so I would definitely try to find out if there is a reason why he doesn't want to go in the school bathroom, or if this has some other root. Great suggestion, PTree.