what happens when non-metals react with oxygen?

They form non-metallic oxides. For example, carbon reacts with oxygen to form either CO or CO2 (depending upon the amount of oxygen present) but both are non-metallic oxides.

C + O2 ==> CO2 or
2C + O2 ==> 2CO