Before World War I a pre-gas mask existed. These masks were used by divers and firefighters to allow them to swim underwater and be in burning buildings for extended periods of time.
During World War I the first use of Gas was used. This resulted in the adaptation of these devices to protect soldiers from the gas used on them.
A Canadian, Cluny Macpherson, is credited to the invention of the first chemical gas mask. His mask protected people from chlorine gas attacks.