Osteoporosis is genetic, and I really don't think that pregnancy makes much a difference in making you immune to it.
My maternal grandmother had severe osteoporosis before she died, and she had three children. My mother, who's now 75, also has three children, and she's now in the beginning stages of osteoporosis. Her doctor has prescribed medication for her.
My own doctor has told me that because of my family history, and because I have other risk factors for the disease (it's most common in Caucasian and Asian women who are naturally small boned, as I am), I am at risk of developing it when I'm in my 60s and 70s.
So I'm taking steps now to build bone mass, such as running and doing other weight-bearing exercise at least five times a week, and eat enough calcium. Those are probably the best steps for women who are at risk for developing osteoporosis to take.
As I've seen in my family history, pregnancy isn't enough to conquer this disease. My grandmother probably developed it partially because she was a very inactive woman who never exercised, and because she probably didn't eat enough calcium-rich foods (she had a very unhealthy diet). I am glad my mother started exercising regularly when she was in her 60s, and that she's more careful to eat healthy foods than she was when I was a child. I think doing that has helped her ward off the disease as much as possible.