Ionisation (of a drug)
Many drugs are weak acids or weak bases. An acid can donate a proton, with the remaining drug then having a negative charge, while a base can accept a proton to become positively-charged. The ionised, or charged, form of the drug is not able to diffuse across lipid membranes, while the uncharged drug can cross membranes and is therefore able to be absorbed, distribute to tissues, be reabsorbed in the kidney, etc.
Drugs exist in an equilibrium of charged to uncharged drug, with the ratio determined by the pKa of the drug and by the pH of the aqueous environment in which the drug is located. The ratio of charged to uncharged drug can be determined with the Henderson-Hasselbalch equation. To use this equation correctly, it is necessary to know whether the drug is an acid or a base. A drug which is paired with a cation (for example, sodium salicylate), must be an acid since the drug is the anion in that pairing, while a drug paired with an anion (for example, amiloride hydrochloride) must be a base since the drug is the cation in that pairing.
As pH goes down (and H+ concentration increases), acids become more protonated and therefore less charged, while bases become more protonated and therefore more charged. As such, weak acids become more lipid-soluble at lower pH values, while weak bases become more lipid-soluble at higher pH values.