These three exercises are simple yet powerful; practiced regularly, they can fundamentally remake your posture.
Start by doing a set of each exercise once a day for a week or two, just to get used to them. Then bump up the frequency to three times a day, or whenever you feel your posture sagging.
Extend your arms out and up to about shoulder height, bent at elbows with palms pointing up. Squeeze your shoulder blades together. You should feel a stretch along your chest and the front of your shoulders. Hold for 5 seconds. Repeat 5 times. If you feel sharp pain, ease off until you feel only mild tension. If this hurts, hold your arms a bit lower; after doing this exercise a few weeks, gradually raise them.
This technique trains your pelvis to support your spine. Stand using good posture. Relax your hips and let your buttocks protrude somewhat. Place thumbs on lower ribs and fingers on hip bones. Tuck your buttocks under, so your hip bones line up under your lower ribs. Hold for 5 seconds, then repeat at least three times.