As is often the case, prevention is better than a cure, in that it takes little effort to implement some relatively straightforward measures and reduces the chance of the individual experiencing pain as a result of an injury.
Warming up properly before exercise can seem like a waste of time, but it serves an incredibly important function in making the body ready for the demands of exercise. It makes synovial fluid less jelly-like and more liquid in consistency, which in turn means the joints are better lubricated. It also increases blood flow to muscles, tendons and ligaments. It should be done before stretching to reduce the likelihood of pain and injury.
Using the right equipment, such as choosing running shoes rather than fashion trainers for jogging, and learning the correct technique for the sport being undertaken by getting advice from a coach or healthcare professional. Not pushing the body beyond what it can do, and taking rest periods and days to allow the body to recover.
Staying hydrated by drinking plenty of water before exercise, and during, if needed.
Stretching muscles to improve flexibility, before and after exercise.