A remarkable analogy is established between the well-known spin Hall effect and the polarization dependence of Rayleigh scattering of light in microcavities. This dependence results from the strong spin effect in elastic scattering of exciton polaritons: if the initial polariton state has a zero spin and is characterized by some linear polarization, the scattered polaritons become strongly spin polarized. The polarization in the scattered state can be positive or negative dependent on the orientation of the linear polarization of the initial state and on the direction of scattering. Very surprisingly, spin polarizations of the polaritons scattered clockwise and anticlockwise have different signs. The optical spin Hall effect is possible due to strong longitudinal-transverse splitting and finite lifetime of exciton polaritons in microcavities.