Is it all in the mind?
Painful sexual intercourse can also be caused by psychological factors. If you experience pain during sex once, you may become afraid of experiencing the pain again. This can create a vicious circle of fear of the pain, which makes it difficult to relax, which can then make it painful when you next have sex.
Fear of the prospect of pain could also make you start avoiding whatever leads to the pain, leading to an aversion to sexual intercourse.
If you have suffered sexual abuse in the past, it could be a factor in finding sex difficult, physically and emotionally.