Muscles attach to bones through ligaments. Muscles and ligaments work to move, support or stabilize bones. When your body is held in a position outside neutral for an extended period...like slouching for example. The classic sitting in front of the computer, back curved, shoulders rounded, head extended. In this scenario, you are holding your body in a position that is outside the comfort zone for your bony structures and muscles. This fatigues muscles that are contracting to keep you in that position and weakening the antagonist muscles because they are being over-stretched. This leads to muscle spasms, decreased muscle tone, trigger points (which are knotted bunches of muscle fibers) and in turn pain and discomfort. The muscles and ligaments involved are also pulling on the bony structures that they are attached to, like the shoulder joint. So, everything is all jammed up and all you did was slouch at your computer for an hour. Can you imagine the health of those muscles and joints if you slouched everyday? Also, the muscles that stabilize the spine are always involved when you sit, stand, move and even breathe. So improper posture can just as easily affect the lower back and hip joints. In most cases both parts of the body are involved and even down to the muscles of your legs and feet. Everything is connected. Imbalance in the shoulder puts pressure on other muscles to compensate and can very well present as lower back pain.
The abdominal muscles are also very important in maintaining proper posture. If you have weak abdominal muscles, your stabilizing back muscles have to compensate to keep you upright. When there is a balance is the front and the back, your muscles can work more effectively and with less tension which means less pain and spasms for you in the long run.
As a student of Tai Chi & Qi Gong, I often recommend it to my clients who are interested in developing a better posture. It's very slow moving so it's great for those of us who live with chronic pain and have a hard time moving and positioning. Yoga is also great for learning posture but it is definitely more strenuous than Tai Chi or Qi Gong. Even if you took one class, I think you would be able to grasp a foundation that could last a lifetime as far as posture goes.
Developing a mindful awareness of your body and your posture gradually will turn into a good habit that can help you maintain balance and alignment within your body's muscles and skeletal structure, which means less trips to the massage therapist or chiropractor to alleviate pain and soreness but don't tell anyone I said that. :)