Eat high-fiber foods. Whole-grain cereals, vegetables, fruits, beans, whole-wheat bread and brown rice can prevent constipation. Drinking plenty of water and daily physical activity can also help.