We can and we do evolve immunities to specific diseases.
Tuberculosis is a good example. In the 17th-19th centuries it was often the largest single cause of death among Europeans, particularly in cities . What’s more, it was a disease of young adults, with most victims being in their 20s and early 30s.
TB exerted enormous selective pressure on European populations. It not only killed large numbers of people, but killed them in their child-bearing years, preventing them from having more children and orphaning the ones they already had. There is a good reason why so many Georgian and Victorian novels feature orphanages – they were ubiquitous in the cities of that time.
TB began to decline long before effective medical therapies (i.e., antibiotics) were developed. It also declined well in advance of improvements in living conditions and better nutrition . There is little evidence that public health measures such as quarantines were effective , except for pasteurization of milk, which slowed transmission of bovine TB to humans.
Given the high death rate and the lack of other good explanations for TB decline, natural selection for resistance seems a plausible hypothesis. We know that cattle show heritable resistance to Mycobacterium bovis, the cause of bovine TB .
We also know that different human populations show differing susceptibility to TB. W. W. Stead, a director of Arkansas’ Department of Health, studied differences in TB rates among European, African and American inmates in prisons and sanatoria. Because the rates of transmission and exposure are high in these institutions, he could collect a lot of data. And since living conditions (post-segregation) were highly similar between these populations, he could rule out environmental factors as a cause. Over decades of research, he found that African-Americans were nearly twice as susceptible to TB infection as whites, and that American Indians were even more susceptible than African-Americans . He noted, somewhat more speculatively, that this hierarchy of susceptibility correlates with degree of ancestral historical exposure to TB.
Modern genetic and genomic analysis backs up the case for selection of TB resistance. The epidemiology of rheumatoid arthritis, an auto-immune disease, correlates with TB resistance . It appears that heightened immunity to TB also carries the risk of causing the immune system to over-react to the body’s own tissues. This is something to keep in mind when you hear about treatments that “strengthen” the immune system – more activity means more risk of autoimmune disease.
Several specific genetic variants associated with TB resistance have been identified. Not surprisingly, many of these affect immune system function either directly or indirectly, and their prevalence varies across human populations    .
As the TB/arthritis example shows, sometimes resistance to one disease triggers susceptibility to another. More importantly, disease-causing organisms also evolve, as our illness is their survival.
We absolutely can evolve resistance to some diseases. But only some, and perhaps only temporarily before they evolve new means to overcome our defenses. And we will never evolve resistance to all disease. There are plenty of diseases that have little effect on reproductive fitness – all the diseases of old age, such as heart disease and cancer, for instance. We have probably already evolved all the resistance to those diseases that we ever will, and have to rely on medicine to reduce their death toll.
 The history of tuberculosis
 Historical declines in tuberculosis in England and Wales: improving social conditions or natural selection?
 Public Health Nihilism vs Pragmatism: History, Politics, and the Control of Tuberculosis
 Bovine tuberculosis: the genetic basis of host susceptibility
 Variation in vulnerability to tuberculosis in America today: random, or legacies of different ancestral epidemics?
 Is rheumatoid arthritis a consequence of natural selection for enhanced tuberculosis resistance?
 Two loci control tuberculin skin test reactivity in an area hyperendemic for tuberculosis.
 Human ULK1 Variation and Susceptibility to Mycobacterium tuberculosis Infection.
 Single Nucleotide Polymorphisms in IL17A and IL6 Are Associated with Decreased Risk for Pulmonary Tuberculosis in Southern Brazilian Population.
 HLA class II sequence variants influence tuberculosis risk in populations of European ancestry.