K.
This is really common at his age. For some reason pooping scares a lot of kids, so as a result they hold it. This leads to constipation which makes pooping hurt and then it is a vicious cycle. Run ASAP to the store and get Miralax. It softens poop. It is easy to mix into milk, juice, or water because there is no taste. Also, maybe have some type of reward system for every time he poops in the potty. My nephew got a matchbox car each time. My friend's daughter got a jellybean. Maybe get some special books that are for reading only when he is sitting on the potty.
Good luck!