From what I know, yes, a fever is a result of the immune system's response to a medical condition that a person may have. In some cases it could be something very minor such as the flu, various skin...
to get rid of the "bad" stuff that has entered your body that the nonspecific defense didn't kill basically choosing the specific "things" that are specifically made to kill the specific "bad" stuff