Elements present in the same group share common chemical properties. Oxygen, Sulphur and other elements are present in group 16/VIA which is also known as chalcogens.
Sulphur and Oxygen have similar electronic configuration. They share the same chemical properties as they are associated with the same group. Oxygen and Sulphur reacts with the Hydrogen gas in a similar manner. They do not belong to the same period.
Since they can still be unstable...nuetral atoms have the same amount of protons to electrons but to be stable they need to fill up there outer shell by gaining or losing electrons