and I can tell you that cleaning up 5 year old poop from someone else's child was really hard, I used to heave when trying to clean him up so I understand a little why your son's teacher didn't want to do it.
I read everyone's posts but I think as Pinkduck that at 4 years old he is old enough to understand and to poop in the toilet. I wonder if he has a problem with constipation - Dayna does sometimes and I have to give her things to eat that make her poop more freely - like papaya, she even asks me for papaya now when she is having problems pooing. Also, have you checked he doesn't have any small piles or a sore bottom that gives him a reason to be frightened of going to the toilet. I'm sure he feels really uncomfortable pooping in his pants and I am sure at the age of 4 he is made fun of at school.
With my ex's son, we would have him at weekend and he would be trained then he would go back home and they would put him straight back into pull-ups. It used to really annoy me because he could do it and it was his mother giving him the OK to poop in pull-ups at 5 years old. I also made him wash his own underwear when he pood in his pants - he did stop doing it because he hated having to touch it. OMG, I'm probably going to get flamed for this.
Anyway, I think any child would lose their self confidence etc if they were being made fun of by teachers and students for pooing in their pants. It is very important that somehow you teach you DS its not ok, I hate pull ups as children use them as diapers and don't know the difference. I can imagine children telling your DS he smells and laughing at him. I'm sorry to be hard but that's kids, they find anything to make fun of other children and it really isn't nice.
Can you take ds out to buy some nice underwear and offer him a toy that he will be able to buy when he poops in the toilet, blackmail always seems to work.
Good luck future baby, Hope you don't think I'm being hard but as the saying goes, sometimes we have to be cruel to be kind.