Hello,
This is due to 
urinary tract infection. This is cause by sexual intercourse, especially if more frequent, intense, and with multiple or new partners, 
diabetes, poor personal hygiene, problems emptying the bladder completely, having a urinary catheter, browel 
incontinence, blocked flow of urine, kidney stones, some forms of 
contraception, 
pregnancy.
Treatment : There are several measures that can be taken to reduce the risk of developing a UTI:
Drink lots of water and urinate frequently. Avoid fluids such as alcohol and caffeine that can irritate the bladder.
Urinate shortly after sex. Wipe from front to back after urinating and bowel movement. Keep the genital area clean.
Showers are preferred to baths and avoid using oils. Sanitary pads or menstrual cups are preferred to tampons. And you need proper antibiotics medication. It may affects your sex life if not treatment given.
Hope I have answered your query. Let me know if I can assist you further.
Take care
Regards,
Dr. Arup Majumdar