Diverse processes—e.g., environmental pollution, groundwater remediation, oil recovery, filtration, and drug delivery—involve the transport of colloidal particles in porous media. Using confocal microscopy, we directly visualize this process in situ and thereby identify the fundamental mechanisms by which particles are distributed throughout a medium. At high injection pressures, hydrodynamic stresses cause particles to be continually deposited on and eroded from the solid matrix—notably, forcing them to be distributed throughout the entire medium. By contrast, at low injection pressures, the relative influence of erosion is suppressed, causing particles to localize near the inlet of the medium. Unexpectedly, these macroscopic distribution behaviors depend on imposed pressure in similar ways for particles of different charges, although the pore-scale distribution of deposition is sensitive to particle charge. These results reveal how the multiscale interactions between fluid, particles, and the solid matrix control how colloids are distributed in a porous medium.