(covers information from several alternate timelines)
The environmental controls of a starship, space station, or even a colony were used to regulate atmospheric conditions including, but not limited to, the concentration of varying gases, lighting, temperature, humidity, and gravity.
Environmental controls were often used to deploy certain chemicals ship-wide or station-wide. This was done for both benign purposes, such as the release of a retrovirus to cure a ship-wide epidemic, (TNG: "Genesis"; VOY: "Macrocosm") or for more aggressive purposes such as the release of a general anesthetic. (TOS: "Space Seed"; TNG: "The Hunted", "Clues"; VOY: "Message in a Bottle"; DS9: "Tacking Into the Wind")
Aboard Federation starships and space stations, it was typical for there to be limited access to environmental control within crew quarters in order to meet the varied living requirements of these multi-species structures.
When Chief Engineer Geordi La Forge left the USS Enterprise-E to make repairs on Zefram Cochrane's Phoenix in April of 2063, he named Lieutenant Paul Porter as being in command during his absence. He also ordered Porter to check the environmental controls, as it was warm in engineering. (Star Trek: First Contact)
Aboard an NX-class starship, the environmental controls could be operated from a dedicated console in the situation room. As part of a plan for Starfleet to retake the NX-class Enterprise from a Triannon takeover in 2153, the vessel's environmental controls were temporarily rerouted in order to spread a gaseous chemical agent throughout the craft, neutralizing organic explosives inside the Triannons' bodies. (ENT: "Chosen Realm")
In 2373, an attack by the Tak Tak disabled the secondary power couplings on USS Voyager, preventing Captain Kathryn Janeway from accessing environmental controls to distribute an antigen to the macrovirus. (VOY: "Macrocosm")