As a junior doctor I was amazed to learn that constipation was a frequent pediatric disorder. When my daughter started having these problems, I learned that even if you give your kids a healthy diet, they still can develop constipation...
Constipation occurs commonly in children, affecting up to 10% at any given time! Still, not more than 3% of parents actually seek advice from a doctor for this condition. Constipation describes the infrequent passage of stools (bowel movements) or the passage of hard stools. Any definition of constipation depends upon comparison to how often the child normally passes stools and to the normal consistency of his or her stools.
One of the things that is frustrating for lots of parents is trying to understand why their child is constipated. Although many parents understand the role that too much cow's milk, a diet low in fiber and not drinking enough fluids have in contributing to constipation, they may have other children with the same diet who aren't constipated...
In addition to your kid's diet, the other important factor that contributes to constipation is having infrequent bowel movements. This often occurs after a child has had a large, hard and painful bowel movement, which can occasionally occur in anyone. After this, because (s)he may associate having a bowel movement with pain, (s)he will try to hold his/her stools. This creates a vicious cycle, where bowel movements are painful, so the child holds them in, causing the stools to be even larger and harder, which causes more pain when it finally does pass. Many parents mistake the behaviors that children develop to hold in stool as straining to have a bowel movement, but they are usually stiffening their muscles or fidgeting as an attempt to hold their stool in and avoid a painful bowel movement.
During the last thousands of years, when cholera and other gastro-intestinal infectious diseases were common and killed many people (especially children), natural selection favored people with slow bowels. I believe that is one of the reasons so many people have problems with their bowels.
Other factors that can contribute to constipation and infrequent stooling are: a bad experience with potty training or avoiding strange toilets (i.e. at school).
Non medical treatments for constipation include the 4 F's: more fluids, more fruit, more fat and more fibers. Of these 4, fluids (preferably water) and fibers (mainly found in vegetables like peas and beans) are most important.