The magnetic structure for the newly discovered iron-arsenide compound CaFeAs has been studied by neutron powder diffraction. Long-range magnetic order is detected below 85K, with an incommensurate modulation described by the propagation vector k=(0,$delta$,0), $deltasim$ 0.39. Below $sim$ 25K, our measurements detect a first-order phase transition where $delta$ locks into the commensurate value 3/8. A model of the magnetic structure is proposed for both temperature regimes, based on Rietveld refinements of the powder data and symmetry considerations. The structures correspond to longitudinal spin-density-waves with magnetic moments directed along the textit{b}-axis. A Landau analysis captures the change in thermodynamic quantities observed at the two magnetic transitions, in particular the drop in resistivity at the lock-in transition.