To prevent stiffness, do exercises that take your joints through their full range of motion. For example, lift your arm up and over your head, or bring your leg out to the side and back.
Do a series of stretches at least twice a week. Pay special attention to muscles that tend to get tight and spasm, like the quadriceps, hamstrings, and calves. As you stretch, slowly move each muscle into position. Hold the position for up to 1 minute. Then, gently release it.
You can do these exercises alone, or you can work with a physical therapist who will show you how to do each movement safely and effectively.