Hi,
    Thanks for the query. I understand your concern.
I am sorry for the mishap. To answer your first query.. itis very difficult to say weather it was PID causing 
abortion or viceversa.. only your treating doctor can throw some confirmatory   light .
    Though sexually transmitted infection is usual cause..of PID ...but any other bacterial infection reaching upper genital tract (through Vagiña.. 
cervix... 
uterus .. fallopian tubesof a woman )can cause it. 
 So either you had it first (as it may be asymptomatic ¬ detected)&it caused abortion OR..PID can be post abortal or 
post delivery infection too so you had it after abortion.
    * Whatever may be the sequence... it had lead to a loss .
     *The good news is it need not recur... if taken care of in time.So you should put off all the tension &
depression  to start getting investigates I (specially 
high vaginal swab culture &sensitivity test.& start with suitable antibiotic under your treating gynecologist's guidance.
     Complete cure of the  inflammation /good general condition/ getting through examination of genital tract before planning of conception would give you a healthy child.!cheer up!best of luck.
 Thanks.