Miasma theory was a prevalent scientific theory that believed that most contagious diseases had an environmental cause. It was well supported in science until the work of Robert Koch in the late 19th century largely confirmed the germ theory of disease that was first proposed by Louis Pasteur. It lives on in modern environmental medicine and in the name of such diseases as malaria which were thought to have an environmental cause.
Medical science had noted that many diseases seemed to be clustered around a common source, and that such diseases often thrived in non-ideal conditions, such as near sewage and swamps. It was theorized that decaying flesh and organic matter gave off some sort of invisible deadly gas that caused the contagion.
However, as epidemiology and experimentation improved, the miasma theory was found wanting. For example, cholera, which was thought to be caused by bad air, was found to affect well off areas and miss some slums. Moreover, the disease was traced to the use of certain wells rather than proximity to sewage.
Koch's work definitively showed that certain micro-organisms caused certain diseases, and miasma theory fell out of favor.