A cut and paste from WebMD:
"Group B streptococcus screening: Vaginal and rectal swabs are taken at 35 to 37 weeks of pregnancy to detect group B strep bacteria. Although group B strep can be present in up to 30% of all healthy women, it's the leading cause of life-threatening infections in newborns and can also cause mental retardation, impaired vision, and hearing loss. Women who test positive are treated with antibiotics during delivery to protect the baby from contracting the infection at birth. As an alternative, your physician or midwife may choose not to test for strep but to treat you in labor if certain risk factors develop."
Quite honestly, it doesn't really matter how one gets it. It could be considered 'sexual contact' if there is cross-contamination between vaginal and rectal secretions. The bottom line is that you don't need to feel like you've done anything wrong.