The ozone layer is formed naturally by a two-step reactive process. The sunlight reacts with O2 and breaks it into O atoms and then an O atom reacts with the O2 to produce O3.
Ozone is a deadly poison but it forms a layer in a higher level of the atmosphere and protects the earth's surface from UV radiations from the Sunlight.
The ozone layer is depleted when it reacts with the Chlorofluorocarbons (CFCs) which is a synthetic chemical used in refrigerators and fire extinguishers.