Progress in pooping is fragile at first. A child has learned that the potty is safe, but one bad experience can undo that: a hard poop that hurt, a flush that frightened them, a fall, an adult who got cross. The body remembers, and the next urge brings holding instead of the potty.
Illness is a quiet trigger. A stomach bug, a few days of eating little, a course of medicine or a fever can change the poops, and a harder-than-usual poop after recovery is often where regression begins.
Life changes do the same thing from a different direction. A new baby, a house move, a new classroom or a parent travelling all reduce the sense of safety that pooping depends on. The child is not losing a skill; they are losing the conditions for it.
Sometimes the trigger is the training itself: a push to drop pull-ups, a reward chart that made pooping a performance, or a lot of adult attention on the toilet. Taking the pressure back off is usually enough to let the skill resurface.