Consider a compound such as:
CH3-CH2-CH2-CH2-CH2-CH2-CH2-CH2-COOH
and focus on the carboxyl group:
At low pH where there is a high concentration of H+, the
pressure is to keep the hydrogen from ionizing. This compound is thus dominated
by the long hydrocarbon chain and is essentially non-polar despite some
effect of the weakly acidic carboxyl group.
At high pH and low H+, ionization is favored. This leaves a charged group to dominate and makes the compound essentially polar. By switching from one pH range to another, the compound changes its polarity and its preference for residing in either a polar or non-polar solvent.