Pain during sex, or dyspareunia, can have various causes, including vaginal dryness, infections, pelvic inflammatory disease, or conditions like vulvodynia. Psychological factors may also contribute. A comprehensive evaluation by a gynecologist can help determine the underlying cause and guide effective treatment.