Injuries can occur for a variety of reasons but most often occur when you over-train or push yourself too much.
When training, aim to make steady weekly progress and you will reap the rewards as you build up to your big race. If you increase the volume or intensity of your training too quickly, you risk over-reaching and picking up niggles and strains which, if not addressed, can lead to greater injury issues.
It’s also worth ensuring that every few weeks you include a ‘step-back’ week in your schedule. This remains an active week of training, but will have less mileage or intensity than a full-on training week. Like rest days, these step-back weeks give your body a greater opportunity to adapt to the training loads you’ve placed upon it at other times.
Get into the habit of warming up and stretching effectively (dynamically if possible) before each training session and cooling down afterwards - don’t just finish your run and sit on the sofa with a resolve not to move for the rest of the day! A few minutes of light post-run stretching of the main muscle groups (quads, calves, hamstrings and hips being the main ones to focus on) will help avoid muscle soreness the next day, as will eating and drinking appropriately in the hour following your training session.