A mucus plug develops in every pregnant woman. You have one.
It acts as a cork for your cervix, keeping out all of the things floating around in your vagina. Bacteria, sperm, whatever else might be up there.
It protects your baby, blocking it completely off from the outside.