For the unconventional heavy fermion compound SmOs4Sb12, the temperature dependence of the Sm valence state was investigated by Sm L-m-edge X-ray absorption spectroscopy under the application of pressure. The Sm valence was found to fluctuate up to a pressure of 3.5 GPa. From the pressure and temperature dependence of the average Sm valence, it was concluded that the Sm divalent contribution plays an important role in the heavy fermion behavior of SmOs4Sb12. Pressure dependence of a characteristic temperature in the Sm valence states exhibits a minimum at around 1 GPa. This finding demonstrates the correlation between the Sm valence and heavy fermion behavior in SmOs4Sb12.