When a person becomes infected with a virus, their immune system defends their body against the virus. The immune system stops the infection and tries to prevent future ones.