Squatting, done properly, compresses the spine -- but we have evolved to tolerate spinal compression. Assuming you don't bounce off something hard at the bottom of the squat, the spinal compression forces are extremely low and should present no risk unless you have a pre-existing spinal injury. Consult your physician before beginning any diet or exercise program.
Mechanics of Spinal Compression
In between the vertebrae or bones of your spine are encapsulated disks filled with fluid. The disks compress in response to stress, and the level of stress doesn't need to be great to achieve compression. Walking is enough, and descending a flight of stairs at decent speed subjects the spine to a high level of compression given the sudden stoppage of each leg as your foot strikes the next step. As long as the compression is relatively even and not sudden -- such as in a fall -- there is no need to worry in any daily activity, including most types of exercise.
Squatting and Spinal Compression
The degree of spinal compression you experience depends on the amount of weight you lift, the speed at which you lift and the degree you lean forward when squatting. The more weight you lift, the more force you must generate and the more compression your spine is subject to. You also generate additional compressive force by aggressively accelerating the barbell. If this is a concern, squat slowly and under control at all times, never bouncing out of the bottom of the repetition. Leaning forward doesn't increase compression but causes it to be applied unevenly, which is not helpful. Leaning forward increases the shearing force on your lower back, which is even less helpful.
Compression vs. Shear
If you lean forward, your vertebrae push down on your disks at an angle. This can cause your disks to compress, and much of the fluid can be pushed out from between the vertebrae -- which can cause the bones of your spine to grind together. Shearing force is what occurs when the force that's applied to your spine is applied at an angle, and the more you lean forward, the more your muscles must compensate for this additional force. The musculature of your lower back fatigues before your hips and legs, so if you continually lean forward when squatting, your lower back gives out first.
Proper Squat Technique
Squats are an extremely safe exercise when performed properly. They recruit most of the muscles of your legs, hips and abdominals. The degree of lower back recruitment depends on how much you lean forward, so strive to minimize this. To squat properly, ensure that your lower back is arched slightly throughout the entire movement, and when you stand up from the bottom position, push your head and shoulders back instead of standing straight up. Push your hips forward as early as possible. Both of these actions minimize shear on your lower back. Although they may increase the compressive force, that's the type of force you're most able to tolerate.