My father was fairly tall, and had a slouch from always ducking (we lived in Africa, and he towered over most people, and was always banging his head).
My mother was always nagging me to "sit up straight."
These days, I have fairly good posture. Part of it, is because I take a 5K brisk walk, every morning, and that helps me to stay straight. Also, I am not that tall, so I don't need to keep ducking.
I also use a standing desk, and like to stand straight for it.