Your immune system is always busy fighting incoming threats. It consists of a system of cells, and when there is a shortage of cells, it affects the performance of the immune system.
This is seen in e.g. cancer patients following chemotherapy. This is because chemotherapy targets all the cells in your body, including the stem cells in your bone marrow, which were meant to develop into new immune cells. This means that the immune system then lacks cells to fight new infections.