Immune normally in English means an inability to develop a disease, normally due to inoculation. But the word did not always carry this meaning, and far predates vaccination.
In 15th Century to 17th Century the sense of the word meant ‘free from liability’. The word entered English from Middle French, and the word immun, which is from the Latin immunis.
The Latin word meant free from taxation or public service, and is formed from: the prefix -in which is the source of the English prefix that gives words like inability or inaction; the word munus meaning a duty or service or obligation, which itself is derived from the PIE root *moy-nós meaning to change or exchange, which is also the root of words such as municipality.
Goods exchange is crucial to the existence of early societies, and so the word for exchange of goods came to mean a conformation to society. From the PIE through a Germanic root (*gamainiz,) Old English gets the word gemæne meaning common or mutual, which is the origin of the English word mean with the sense of lowly or inferior, selfishness or without dignity.