The transport of hydrated ions through narrow pores is important for a number of processes such as the desalination and filtration of water and the conductance of ions through biological channels. Here, molecular dynamics simulations are used to systematically examine the transport of anionic drinking water contaminants (fluoride, chloride, nitrate, and nitrite) through pores ranging in effective radius from 2.8 to 6.5 Å to elucidate the role of hydration in excluding these species during nanofiltration. Bulk hydration properties (hydrated size and coordination number) are determined for comparison with the situations inside the pores. Free energy profiles for ion transport through the pores show energy barriers depend on pore size, ion type, and membrane surface charge and that the selectivity sequence can change depending on the pore size. Ion coordination numbers along the trajectory showed that partial dehydration of the transported ion is the main contribution to the energy barriers. Ion transport is greatly hindered when the effective pore radius is smaller than the hydrated radius, as the ion has to lose some associated water molecules to enter the pore. Small energy barriers are still observed when pore sizes are larger than the hydrated radius due to re-orientation of the hydration shell or the loss of more distant water. These results demonstrate the importance of ion dehydration in transport through narrow pores, which increases the current level of mechanistic understanding of membrane-based desalination and transport in biological channels.