Infants typically grow out of dyschezia by 9 months of age. Dyschezia is a medical condition whereby the infant cannot coordinate their muscles to push stool out of the body.
Some toddlers go through a period where they withhold poop and refuse to defecate. This is different from both dyschezia and constipation and may be due to fear associated with passing stool.