The ion distribution function has been calculated as a function of the distance ℓ along a field line and of the corresponding velocity, v ≡ dℓ/dt, in a stellarator divertor. The kinetic equation for the ions is solved, treating the divertor as a pre-sheath with arbitrary collision frequency under the influence of a magnetic field which varies in magnitude with ℓ. The electrostatic potential is found self-consistently with the ion distribution (assuming a Boltzmann distribution of electrons). The effects on the confinement time of the very strong variations in magnetic field strength B with ℓ and the effects of varying B(ℓ) using an applied vertical magnetic field are assessed for the Interchangeable Module Stellarator (IMS).