Squatting is a great exercises for developing a strong body but if done incorrectly can leave you with a herniated disc and a lot of pain. This movement has become a lot more popular again due to the explosion of crossfit and olympic weightlifting as it forms the foundation for many more complex movements like the clean and jerk and snatch. Its great for building a strong foundation of strength and should be the corner stone of any athletes strength and conditioning.
However, this exercise has a high risk of injury when performed incorrectly due to the often heavy loads and poor technique or both. The squat requires good mobility in the hips, knees and ankle joints whilst having great stability and motor control to co-ordinate the show. Having great hip flexion is probably the number 1 factor that differentiates a natural squatter from everyone else. This hip flexion is mainly determined by the anatomy of your hip socket, the shallower the socket the more depth you'll achieve, the deeper your socket the less depth you'll have. When you see a world class weightlifter you'll see how low they can squat whilst keeping their spine in that neutral position (Lu Xiaojun pictured below, left). Lu Xiaojun is an example of a person who will have a shallow hip socket enabling him to get into the position of extreme hip flexion whilst maintaining a neutral spine. This ability to maintain the natural lumber lordosis at extreme hip flexion allows loading without a high risk of injuring your back.
In contrast to the picture of the guy on the right who's back is bent like a banana. As you can see his back has lost its lumber lordosis and has gone into flexion, putting a lot of stress on his lumber discs. Done often enough this will lead to a herniated disc or "slipped disc" as its commonly known. This guys hip socket is probably deep and thus does not allow as much hip flexion, he can go low but only if he gives up lumber alignment and goes into lumber flexion. its commonly referred to as a "butt wink" or "bum tuck". A shallow hip socket might sound great but it doesn't come without its disadvantages. Although great from squatting and generating power out of the hole its generous mobility makes its a lot more unstable than a deep socket. Its no surprises then that Eastern block countries who's people genetically tend to have shallow hip sockets tend to produce world class weightlifters but also the incidence of hip dislocation is higher than normal.
So the key to preventing injury when squatting is to only go to the point just before your lumber spine starts to go into flexion. Beyond this point you greatly increase your risk of hurting your back which can often have long lasting effects.