Contrary to popular opinion, the bulk of scientific evidence does not support the premise that stretching before exercising will help prevent injury. Most injuries occur during eccentric contraction within normal range of motion. Therefore, increasing your range of motion before exercise is unlikely to help you prevent injury.
The benefit seen in studies that support stretching before exercise as a way to avoid injury appears to be due to the warm-up sequence, not the stretching. The purpose of the warm-up is to increase blood flow to your muscles, and there are many simple ways to do this. Exercises such as squats, jumping jacks, cycling and even walking are all good examples of warm-up exercises. Simply do them for a few minutes until you're breathing heavily. Aside from lowering your risk of injury, warming up before exercising has also been shown to prevent delayed onset muscle soreness (DOMS), which is a common complaint after intense exercise.
So, as with stretching before exercise, it turns out it’s not the stretching after exercise that is the most useful if you’re looking to prevent pain and injury. A more beneficial option is active recovery or active cool-down, such as light weightlifting, mild yoga, cycling, walking, rowing or swimming. Active recovery is very similar to the warm-up, low-intensity exercise. In other words, you’ll want to slowly 'wind down' after your workout. Rather than abruptly quitting and going to rest, you continue exercising at a much lower intensity for a few minutes.
Benefits of active recovery or cool-down include reduction of lactic acid build-up in your muscles, which will help minimize post-exercise stiffness and pain, and the promotion of blood flow to heavily taxed muscles, which will help counteract inflammation and improve healing. Massage is also considered to be the most powerful technique for recovering from DOMS and fatigue.
There are few hard and fast rules when it comes to exercise and its pre- and post-activities. As a general rule, however, it seems generally accepted that a quick warm-up period is advisable before you start your workout. Stretching before working out is unlikely to provide you with any significant protection from injury though.
Afterward, using active recovery or active cool-down techniques are likely to be your best bet. At the very least, it’s better than an inactive cool-down where you abruptly stop. Stretching after your workout may not protect you from pain or injury, either, but long-term, stretching is an important part of a well-rounded fitness program, and will improve your flexibility and thus mobility over time, so it should not be discounted entirely.