It serves a great purpose. The mucous plug is like Jell-O that you left out overnight. It's not a soft Jell-O consistency but more of a squishy Jell-O consistency (I'm making faces as I think of how to describe it, ha ha). Losing mucous throughout pregnancy isn't always the plug; the plug is definitely not as slimy I guess you would say.
However when you see mucous streaked with blood that is bloody show which is different because it does signify impending labor. Most women go into labor within 24 hours of bloody show though it can take up to a week after having it for others. I had bloody show 2-3 days before I went into labor with my youngest daughter.
I also want to add that most women don't notice themselves losing the mucous plug (it typically comes out in bits and pieces, not one big chunk). Some women don't really lose it until they're already in labor. And Clysta is correct that it can regenerate.
Ok.. I thought it was their for "no reason". I remember my sisters telling me about when they lost theirs. I thought maybe it was a signal of labor..
The mucous plug is there to prevent bacteria from entering the uterus. It's more or less how it sounds. Generally women will start to lose it a few weeks prior to delivery or the day of delivery. It can look green and snotty, brown, and when you're about to delivery often is streaked with red. Mine personally was brown...goo and happened a few hours before I went to the hospital. It also can rebuild itself, so even if you start to lose it early (for example like 30 weeks) it doesn't mean labour is impending.