Method 1 of 3: Preventing Constipation. 1. Feed your baby a fiber-rich diet. Certain types of solid food are more likely to trigger constipation, like bananas, carrots, and rice cereal. Other foods can prevent infant constipation, including prunes, pears, oatmeal, and barley cereal. Ad. 2. Keep the baby active. Low activity levels can lead to constipation.