Some pigs are born without an anus. I've seen this a couple of times. They die. However, assuming your pig has been pooping before and has an opinion, er, I mean anus, like most people then it is possible you've got, in order of severity, constipation, a blockage or worst yet torsion.
Constipation: Laxative, even butter, should help.
Blockage: This is much more serious and not a whole lot you can do but hope hit passes. Butter might help. I would probably slaughter if this doesn't fix it quickly.
Torsion: Sometimes the internal connections that hold the intestines in position are loose and a piece will twist. This is very bad and the pig will almost certainly die. I would slaughter immediately as a roaster.
Hard to know the problem until you disassemble the pig and look inside.
Basically it comes down to plenty of water, perhaps a laxative and butter.
Sugar Mountain Farm
Pastured Pigs, Sheep & Kids
in the mountains of Vermont
Read about our on-farm butcher shop project:
ButcherShop | Sugar Mountain Farm