J.S.
First off, you weren't wrong for changing schools. Changing schools has nothing to do with this sad situation that happened in the classroom.
Secondly, it might help him if he knows that embarrassing things happen to EVERYONE. Tell him about something G-rated that happened to you that embarrassed you in front of an entire group of people, and how you dealt with it.
What happened wasn't so awful that it's going to ruin his life. Accidents happen. You can even explain that "little boys have little penises/penii?" including the little boy who made that "silly, silly comment." The kids laughed, yes, but they're at an age when naked is funny. Poop and pee is funny. They WILL forget it especially the next time one of them has an accident or throws up in front of everyone.
I would keep the discussion brief and don't let him know how upset you are on his behalf.
And please, don't blame his teacher. She handled the situation perfectly and didn't do anything wrong. Kids are kids, and this was just an unfortunate situation. The key here is teaching him to move past it and not keep reliving it.