If a bacteria or virus reappears, the immune system will recognize them and act faster against them
The immune system mounts a defense to counter the pathogen and manages to control the infection, in the first instance. In addition to suppressing the pathogen for the first time, our body's immune system ‘learn' something about the pathogen that can be used against it, in the second round of infection. And if a bacteria or virus which has infected us earlier the immune will recognize it and act faster against it.