1580s, "a middle ground, quality, or degree; that which holds a middle place or position," from Latin medium "the middle, midst, center; interval," noun use of neuter of adjective medius "in the middle, between; from the middle" (from PIE root *medhyo- "middle").
Many of the secondary senses are via the notion of "intervening substance through which a force or quality is conveyed" (1590s) and "intermediate agency, channel of communication" (c. 1600). From the former, via application to air, etc., comes the sense of "one's environment or conditions" (1865). From the latter comes the sense of "a print publication" (1795) which later grew into the meaning in media.
In spiritualism, "person who conveys spiritual messages," by 1853. In painting, in reference to oil, watercolor, etc., by 1854. The notion is "liquid with which pigments are ground or mixed to give them desired fluidity." Happy medium is the "golden mean," Horace's aurea mediocritas.