meningitis in a baby

How does a baby contract meningitis? My friend has a 6 month old that has it and she's in the hospital right now. I'm just curious! Is there anything you can do to prevent a baby from getting it since they don't receive a vaccine for it until they're much older!