Some people are more able to get these than others.
So, it is a combination of genetics, exercise and being lean (which can be too thin in some cases).
I am not sure that a six pack is a normal thing that everyone should try and achieve.
So the 6 pack that people normally refer to are the muscles in the abdomen (why people call them abs). Everyone has these muscles, but in some people they are more visible due to the size of the muscles themselves, or the amount of body fat that lies over the top of them. You can have perfectly normal, healthy abdominal muscles without having a 6 pack. Typically people will train their abdominal muscles with exercises like sit ups, crunches or other approaches like yoga. Core strength (the strength of your abdominals and lower back) is important for posture and stability and more important that just having a 6 pack.