Is walking good for preventing osteoporosis in the spine?

Yes.

“Anything that makes bone bear weight is good for bone quality,” said Dr. Kirkham Wood, head of orthopedic spine surgery at Massachusetts General Hospital. “All bones – spine bones and big leg bones – will respond to pressure from weight by forming more bone.”