Dear Student,
The electronic configuration of oxygen is 1s2 2s2 2px2 2py1 2pz1 i.e., it has two half-filled orbitals and there is no d-orbital available for excitation of electrons. Further it is the most electronegative element of its family. Hence it shows oxidation state of -2 only. Other elements like sulphur have d-orbitals available for excitation thereby giving four and six half-filled orbitals. Moreover they can combine with more electronegative elements. Hence they show oxidation states of + 2, + 4 and + 6 also.
Regards