Constipation is a common occurrence in pregnancy, and is probably due to the looseness of the digestive tract muscle. In late pregnancy, the constipation worsens because of the pressure of the enlarged uterus on the stomach. Constipation is rarely dangerous and is not a cause for concern.
You will avoid it by eating lots of fresh fruit, vegetables and other food with high fiber content, by drinking lots of fluids, and do not delay the relieve when you feel the need to go to the toilet.
Do not take any constipation medicines before talking to your doctor, because some of these medicines may irritate the intestines.