Reaction between sulfur and sodium hydroxide
The reaction products depends on the conditions(temperature, pressure etc.) and stoichiometric ratio of reactants taken. Depending on that, you will get various products in each case if you slightly change the conditions or the ratio of sodium hydroxide to sulfur taken.


$$\ce{4S + 8NaOH -&gt;[600 C] Na2SO4 + 3Na2S + 4H2O}$$



  Sulfur react with sodium hydroxide to produce sodium sulfate, sodium
  sulfide and water. This reaction takes place at a temperature of over
  600°C.(source)



$$\ce{4S + 6NaOH → Na2S2O3 + 2Na2S + 3H2O}$$



  Sulfur react with sodium hydroxide to produce sodium thiosulfate,
  sodium sulfide and water. Sodium hydroxide - concentrated solution.
  The reaction takes place in a boiling solution.(source)



Your reaction


When you compare the three equation, you can  see that though stoichiometric ratio of the reactants in the 1st and 3rd equation is same, the moles of sulfur and sodium hydroxide  is different and thus gives different products in each case. 

Also, from reaction 2 we can say that sodium thiosulfate may have disproportionate into sodium sulfite and sulfur.

$$\ce{Na2S2O3 -&gt;[220-300 C] Na2SO3 + S}$$

and thus one mole sulfur cancel from each side and gave reaction 3 (your reaction). This site  explains the disproportionation reaction.


  Chemical reactions of sulfur compounds have been studied in equimolar $\ce{NaOH-H2O}$ melt at 100°C by voltammetry and UV spectrophotometry. Disproportionation of sulfur is fast and quantitative according to:
  
  $$\ce{S8 + 6OH- -&gt; 2S3^2- + S2O3^2- + 3H2O}$$
  
  On the contrary, addition of sulfur to sulfide is not quantitative and
  gives $\ce{S2^2-}$ besides prevailing sulfur
  disproportionation.$\ce{SO3^2-}$ reacts with $\ce{S2^2-}$ and
  $\ce{S3^2-}$ , while $\ce{S2O3^2-}$ decomposes $\ce{S^2−}$. A
  pseudoequilibrium is observed: 
  
  $$\ce{S^2- + S2O3^2- &lt;=&gt; S2^2- + SO3^2-}$$
  
  with concentration quotient Formula Q = $\ce{10^{-0.8}}$.