For toddlers ages 2 to 3 years old that are beginning to learn potty training, one of the most common causes of constipation is avoiding going to the toilet. They are often so involved in their play that they avoid potty breaks! As stool remains in the colon, the colon will absorb water out of the stool, making it hard and dry. This hard stool is even more difficult or painful to pass, which causes the child to continue "holding it." So part of potty training is positive reinforcement for children to begin self-regulation of their bowels. The body has a natural reflex called the gastro colonic reflex which is triggered by eating meals. After a meal, have your child sit on the toilet for at least 10 minutes to take advantage of this natural reflex.
Note that some medications can make children more likely to be constipated. Common contributors include over-the-counter cold medications and antacids.