J.M.
My guess is that if it were medical and a genuine accident, he would be upset about the accidents.
If my son started doing this, I would have him help wash out the nasty underwear. I wouldn't make this a punishment - but it would be an absolute requirement. I'd just be very matter-of-fact about the whole thing. Sort of an action equals logical consequence concept. (I did this when my son was wetting the bed. I didn't get upset or anything. It was simply his job to help me take care of the mess. He'd strip the sheets and put them into the washing machine. He'd use Lysol wipes to wipe down the mattress. And would then help me put clean sheets on the bed. Once he had to accept responsibility for cleaning the mess, it didn't take too long before he realized he had an incentive to avoid making it.)