Square is right, but I don't think there's a relationship in the opposite direction.
The "6-pack" muscles are the rectus abdominus (love that medical latin). They are responsible for pulling your forehead to your knees. If you consider rolling up into a ball with your forehead touching your knees good posture, then yes, a 6-pack is correlated with good posture.
Most people, tho, consider standing up "straight" good posture.
I put "straight" in quotes, because your spine is actually S-shaped, not straight. It's good that it evolved to an "S" cause that helps us humans balance our disproportionately large heads on our upright spines. So actually "straightening out your spine" will make you look a bit odd. Your butt and shoulders should stick out farther in the back than your lower back, which should sway a little forward with the "S."
There's a bunch of muscles that keep your spine upright and in the S shape, but the big three, IMHO, are, in order of importance:
1) The transverse abdominals
2) The spinal erectors
3) The obliques
There's also vertebral alignment issues involved as well. One L5/S1 misalignment (the two largest vertebrae at the base of your spine) can throw everything off.
At this point, in my chatty professor mode, I'd type a pile more shit about how to develop said "posture" muscles, but there's a spiced non-fat soy iced grande decaf mocha lattechino foo foo in front of me that is diverting my attention from the keyboard...
* WARNING: "K" is not a medical doctor, chiropractor, psychologist, personal trainer, typist, English major, nor a professional comedian, but thinks he is qualified to be all these things by virtue of the fact that, like, he is, like, so cool.