Many people avoid taking part in exercise when they are hurt. This could actually make the problem worse as the areas that are hurt may stiffen and cause more problems in the long run. Being inactive does not allow the muscle to regenerate properly.
You should also eat a balanced diet when you are hurt to provide the nutrients the body needs to regenerate the lost muscles. The body requires certain nutrients to produce the cells that make up muscle mass.
A lack of exercise can also lead to a slowing of the metabolism. This is because the body is not using the nutrients being put into it, so it does not need to process them. Instead it has a tendency to store them as fat. If this is the case, you should start out on a balanced diet and exercise regime to kick start your body again.
Exercise without a balanced, healthy diet is also not good. The diet will provide the nutrients your body needs to keep up the level of energy needed for feeding your cells when you exercise. So whilst the exercise releases endorphins which deadens pain and increases blood flow which carries nutrients to the body, you need to eat a balanced diet to keep the level of nutrients in the body at a level where they will benefit the repair process.
So, basically, in order to heal an injury properly, you should engage in gentle exercise to increase blood flow and also eat a balanced, healthy diet to keep enough nutrients in the body.