PID is primarily caused by sexually transmitted infections (STIs), especially Chlamydia trachomatis and Neisseria gonorrhoeae. These pathogens can ascend from the vagina or cervix to the upper genital tract, leading to inflammation and infection. Other microorganisms, including anaerobes, Gardnerella vaginalis, and Mycoplasma genitalium, can also contribute to PID.