Something bigger is wrong. He needs help, not punishments.
My SD used to pee her pants because she was playing and didn't want to stop to use the bathroom. She would suddenly not be able to hold it and then pee her pants. This usually happened if she was very absorbed in playing with something, or at our relatives house and there were kids to play with and she didn't want to stop. After peeing, she'd be upset and come to us. We used to have to bring extra underwear and clothes everywhere we went. This happened when she was about 7. There weren't any big differences except when she was about that age we stopped watching her so closely and allowed her freedom to play with her friends. This meant we weren't asking her if she had to go potty when we saw the signs, and she wasn't wanting to go.
What worked for us: have your SIL set a timer for 1 hour. He is to try to go to the bathroom every hour when the timer goes off, meaning he will have to stop playing to do it.
Hopefully he will decide that stopping playing every hour is more annoying than just going to the bathroom when you have to go. My SD decided that she hated having to stop playing every hour to try to go, so suddenly she decided to go when she had to go and the accidents stopped.
If he is playing with poop in his pants, something else is wrong. My SD always came to us right away after an accident and was upset.