Mucus plug

Can someone explain to me: this might be a stupid question and will probably be laughed at but what's with the Mucus plug so I'll know are you suppose to loose it when you get ready to have your baby or something else??????* I'm new at all of this shit 😂