It seems that you're dealing with two separate issues. Constipation can be allivated by taking a fibre supplement, drinking prune juice, and increasing the amount of fresh vengetables that you eat daily.
The medical term for painful intercourse is dyspareunia. This can result from:
* Intercourse too soon after surgery or child birth
* Vaginal dryness or inadequate lubrication (for example, from insufficient foreplay)
* Menopause (vaginal lining loses its normal moisture and becomes dry)
* Vaginal infection
* Reaction to the latex of a diaphragm or condom
* PID, pelvic inflammatory disease
* Prostatitis -- inflammation of the prostate
* Genital irritation from soaps, detergents, douches, or feminine hygiene products
* Herpes sores, genital warts, or other sexually transmitted diseases
* Urinary tract infections
* Endometriosis
* Vaginismus -- involuntary contraction of the vaginal muscles; this may be a result of ongoing painful intercourse as well as a cause
* Ill fitting diaphragm
* Sexual abuse or rape
* Hemorrhoids
* Certain medications
I'd suggest that you call your doctor if the painful sex also coincides with other symptoms such as bleeding, genital lesions, irregular periods, discharge from penis or vagina, or involuntary vaginal muscle contraction.