Sounds as if you have a problem with your walking gait. It happens. We have a injury say to our knee and it is painful, so what we do is not to put all the weight on that sore knee, thereby throwing the hips out of alignment along with the spine. Then we get used to walking like this and next we know the muscles in the lower back and thigh start to hurt and we end up in a vicious circle, imbalance and pain, correct posture and pain, misalignment and pain. So you need to see a Podiatrist and get your upright walking stance seen to. Best of Luck
PS, did you know that too much walking can cause the muscles in our legs to tighten and that pulls the hips out of place, which then pulls the spine out of place.