The behavior of excitons in spatially modulated magnetic fields is described taking into account the exciton spin contribution. The results show that the exciton trapping in periodic magnetic fields is possible and dependent on the modulation profile.