How does stretching prevent injuries?

Not really. Stretching immediately before exercise do not appear to prevent injury, that is different for stretching all others time.Regular stretching, no immediately before exercise, appears(in some cases), may prevent injury.We can not forget the warming -up is what can help more on prevention, increasing circulation, flexibility(rom), giving the muscle possibilitie to be prepare for upcoming activity.
Flexibility. Stretching can help improve flexibility. And better flexibility may improve your performance in physical activities or decrease your risk of injuries by helping your joints move through their full range of motion. Studies about the benefits of stretching have had mixed results. Some show that stretching helps, while others show that stretching has little if any benefit. Low activity based injury.