Dyspareunia is the name given to the condition in which sexual intercourse is painful. Most sufferers are women, although men are also sometimes affected, and the condition can be quite traumatic as apart from the pain sexual pleasure is also greatly diminished. Unfortunately, the condition is quite complex, and it is practically impossible to make a diagnosis without interviewing and examining the patient as well as performing some tests (in case there is a bacterial, viral, or fungal infection). Psychological causes also often play a role - these most often come into play when the woman has experienced pain for a while and then begins to expect it, thus experiencing similar pain even after the original causes have been treated or have disappeared on their own.
Apart from infections, causes of dyspareunia include tumors, endometriosis, and dryness, which of course is easily detectable but will have its own underlying cause that needs to be determined. As with any other health problem, till the cause is determined it is impossible to decide on any treatment. Your wife should visit a good gynecologist as soon as possible to avoid unnecessary pain and depression - dyspareunia can almost always be successfully treated, but requires professional help.
Prevention
Although some causes of dyspareunia, such as a history of sexual abuse or trauma, can't be avoided, other causes can be prevented:
To decrease your risk of yeast infection, avoid tight clothing, wear cotton underpants and practice good hygiene. Change your underclothes after prolonged sweating. Bathe or shower daily, and change into dry clothing promptly after swimming.
To avoid bladder infections, wipe from front to back after using the toilet, and urinate after sexual intercourse.
To avoid sexually transmitted diseases, avoid sex or practice safe sex by maintaining a relationship with just one person, or using condoms to protect against sexually transmitted diseases.
To prevent vaginal dryness, use a lubricant, or seek treatment if the dryness is due to atrophic vaginitis.
If you have endometriosis, avoid very deep penetration, or have sex during the week or two after menstruation (before ovulation), when the condition tends to be less painful.