It depends on the type of antibodies the body generates for the infection. In some cases, the body produces lifelong immunity, where it can prevent the same infection from attacking you twice. In some cases, the body will respond by producing relevant antibodies after the attack and help you heal faster. In case of severe infections, though the body has fought it before and has a memory of the antigens, it needs external reinforcements to fight effectively.