Pain is a very strong feedback signal. The memory of the pain helped me to keep my posture right. Though, I'd prefer to become aware of my posture before the pain emerged.
The sheer power of will :)
To be honest I'd forget and correct it all the time.