After masturbation, my entire pelvic area hurts, as well as inside my vagina (only sometimes). What could be causing the pain?

Endometriosis. It is not uncommon for the uterus and related genito-urinary structures to undergo "contractions"/spasms in the resolution (post-orgasm) phase. This is assuming that orgasm was achieved. Typically, such post-orgasm changes can be sensed as cramping; however, in some situations where endometriosis is present, the uterus and related structures may be scarred down and mobility limited with pain.