As dogs grow older they often develop hip and joint problems just as humans do. Also, they may have hip and joint pain from injuries either recent or older.
I have a dog that was found as a puppy in a steel garbage dumpster by a fireman who rescued him and carried him to the shelter.
When I adopted him he had back problems that they had been treating with steroids. He did not want you to touch his back, not even when bathing him. After I had had him a while he begin to limp and my vet also treated him with steroids. They made him throw up and only particially helped with his limp and back pain.
I tried several things and finally was successful with Bone Meal. I give him one tablet a day and he no longer limps and loves to have his back scratched.