There are several preventative measures for pelvic inflammatory disease. Practicing safe sex and getting treatment for STIs is at the top of the list for preventing pelvic inflammatory disease. There really is no substitute for good, old fashioned, safe sex.
You should always protect yourself first! Whether that means abstinence or condoms or any of the other barrier methods. Since the two main culprits of PID are chlamydia and gonorrhea, the best solution is to really be diligent about protecting your body from these harmful STIs. If left undetected they could leave your body susceptible to the development of pelvic inflammatory disease. You can avoid this by ALWAYS practicing safe sex and seeing your gynecologist at least once a year for your annual pap and pelvic. You can even go more often than that if you feel the need. Go and get tested every three to six months depending on your activity level and the number of partners you have.
It’s better to be safe than sorry.