People are saying its as easy as "JUST THINK IT AND YOULL START DOING IT", if it were that easy then you wouldn't be asking this right now. Another factor to consider is that you probably aren't too aware of your muscles that make up your posture. To answer this you have to understand what makes up your posture, that is....your spinal erector muscles, more commonly known as your lower back.
What are some things you can do to improve your posture? You can start by doing simple prone bridge and holding it for 30 seconds or as long as possible for 3-5 sets, the carryover strength from that to posture is amazing. If your not sure what a prone bridge looks like heres one i found on google images:
Yoga is also a really great way to strengthen your core and lower back, i recommend going for a really intense power yoga class which really works all aspects of your core, thus enabling you to have better posture.