If the baby is over 6 months old then you can give the baby some water to help with constipation.
And if the baby is under 6 months old you can use fruit juice such as Apple Juice, Cranberry Juice and even prune juice.
You can use the juice on babies over 6 months old as well to help a baby with constipation.
Also try moving your babies legs back and forth with your hand like you're pedaling a bicycle, give the baby a warm bath and massage the babies tummy which can usually help a baby with constipation.