Constipation contributes to hemorrhoids. Drink plenty of fluids and eat foods with a lot of fiber, like fruits, vegetables, and whole grain, to prevent constipation. Staying active also prevents constipation.