My son had lots of problems with constipation as a toddler.Bananas were something that caused a problem with him.He couldn't eat those for a couple of years even though as a baby they hadn't seemed to cause a problem.Eggs are something else that ,if they eat them every day can do the same.It may be as simple as a certain food.
Things that helped were lots of fresh veggies and fruit.I used to make a puree of rhubarb with a spoon of brown sugar,he had that every day.I kept yogurts/milky puddings to once a day ,and only two 8 oz beakers of milk a day,but giving juice midmorning,and lunchtime and fresh juice mid afternoon.
When it got really bad we had to give Califig three times a day,as it got to the point he was holding it becuase it hurt,and then it became a cycle,but he was older by then,I don't know if you can give that now.If it carries on you'd be better to see the doctor.
Hope the problem clears up soon