Exercise can have a profound effect on your immune system. Depending on what kind of exercise you are doing, exercise can:
In order to maximize the beneficial effects of exercise on the immune system, you need to understand that all exercises are not created equal. Different types of physical activity will affect your immune response in different ways. Going for a 30-minute walk, running a marathon, and strength training will all have different effects on your immune system.
So, what makes these activities different?
There are two main exercise characteristics that you should pay attention to:
It turns out that (like with almost everything in life) moderation is key. In order to have the strongest and most robust immune system you can possibly have, you should perform exercise at moderate intensities with moderate volume. Any kind of extreme and you start to weaken your immune system.
For example, if you've only been running 10km and then you decide to run 40km, you may suppress your immune system due to the dramatic increase in running volume and intensity.
If you've been lifting weights 2x/week at 2 sets/muscle group/workout then going into 4x/week at 4 sets/muscle group/workout, that extra volume might cause an immuno-suppressing effect.
Research is still not clear whether one bout of intense exercise can significantly decrease immune function. However, we know that perfoming exercise that's too stressful on our bodies with enough frequency can negatively affect the immune system. This is especially true if you have low glycogen stores, inadequate nutrition, poor sleep and a stressful lifestyle.
You should still be introducing volume and intensity to your workouts regularly however, do so slowly. This gives your body an opportunity to adapt to the greater level of stress over time so you reduces chances of overloading your immune system.
Someone might look at the previous paragraph and think "I'm just going to stay where I am now and not risk compromising my immune system by adding more exercise". You should only do this if you suspect you might be overtraining and have trouble recovering.
However, a majority of people would benefit from adding more exercise. This is especially true if you find activities of daily living challenging since these very same activities can have an immuno-suppressing effect.
For example, let's say you are really out of shape and whenever you leave your house you need to take a flight of stairs. If whenever you climb up these stairs you lose breath and need to stop multiple times until you reach the top, then this activity wouldn't be classified as moderate and can therefore temporarily suppress your immune system.