Two-dimensional particle-in-cell simulations are performed to investigate the propagation of low energy continuous ion beams through background plasmas. It is shown that the continuous ion beam can be modulated into periodic short beam pulses by the induced wakefield, which can be adopted as a method to produce ultrashort ion beam pulses. Furthermore, the transport of the continuous ion beam in plasma with density gradient in the beam propagation direction is proposed and an enhanced longitudinal compression by density gradient is found due to the phase lock of ion pulses in the focusing regions of wakefield and reduced heating of plasma electrons.