Wow I went through this many years ago with my son. It turned out that he did have a colon blockage so I put him on a stool softener to try to work that out.
But the real problem I am seeing with this issue is the way it didn't seem to bother the child. I think this is what is so upsetting to the parents. If a child poops in his underware and you ask the child to throw it out or to clean it the child doesn't seem to care and it freaks the parent out. For example I remember seeing my son with his hands in frothy poopy water washing the underwear in the sink while the room stunk it didn't seem to phase him at all. So I'd tell him to throw them out and I'd find them over and over again in the drawer in the room while I sorted for underpants in the morning for the younger son. It was disgusting.
Pyschologically for me it was very very difficult to handle. I wound up hitting him for it, thinking that it was the last resort etc etc etc.
My advice to parents now that I thank god no longer have to deal with this is the following.
Do not allow the child to sit and play video games if this is a problem because the child gets addicted to the game and won't get up. But don't do this as a punishment just don't do it so much.
Second don't freak out. Instead ignore it. When I finally ignored it, it went away. While i was so focused on it, it got worse and worse. For some reason I think its a problem for boys that are very intelligent but don't like to follow rules. Independent thinkers in a way who will "sieze up" at being told that they are doing something wrong, especially if they can see its wrong. They create a sort of denial about what is going on. To me this is the heart of the matter and the thing that is really the issue.
With my son I sat with him and discussed how people many times have difficulty admitting that they are wrong. I used examples from my own life and showed him how I had been wrong. And I sat with him and had him say how he was wrong. I realized that this was the issue when he began crying when I had him say "I am wrong" over and over again just to practice saying the words. The environment wasn't angry or demeaning it was completely supportive and yet he teared up immediately. If you think of the physiology of what is going on you see a child who is holding in and then exploding so this is how I dealt with it. As a symbol of his emotional development.
For me I really can't emphasize and I know most parents won't admit how deeply frightening and upsetting it is when your son or daughter does this. Its very scary because it seems like a sicko thing and we as parents always worry that the child is going to be the next Jeffrey Dahmer because of some horrible misstep on our parts.
This part of it is something you should not ignore. Its definitely going to effect how you respond and is also part of the whole story. The story is that we might be wrong.
I know this sounds very convoluted but seriously when you deal with this for a long time and nothing works its really freaky.
For me, the long conversations about how its ok to be wrong is what you need to focus on. Buy stool softner and ignore it. Its just a stage.
Has any thing changed recently in your home?
Sometimes Kids get a feelings of not having control over anything in thier lives and though it sounds kind of silly or far fetched I have heard and seen more than one child react to a situation like this by pooping or peeing in thier pants, they cant control anything around them, except when they use the restroom, in one case a good friend of mine had a son that only did it when going back to visit his mom, and in htis case the mothers home was unstable emotionally, he would wait until the last second and then poop. In other cases it usually happened because alot of reaction is given to the pooping or peeing, its an attention getter, sometimes we get so caught up in our lives our children perhaps feel they dont get as much attention as they should, and so they act in a way that may get that attention. I dont know if i have helped in any way, I hope I have given you some ideas. Good Luck