You can prevent constipation in several ways, including staying hydrated, eating a fibre-rich diet, and exercising regularly.