ionization
Most drugs are weak acids or weak bases, which means they carry a chemical switch that flips with the acidity of their surroundings. Ionisation is that switch: in some pH conditions the molecule gains or loses a proton and becomes electrically charged (ionised); in others it stays neutral (unionised). The same drug can therefore be mostly charged in the stomach and mostly neutral in the intestine, or vice versa.
Whether a drug is charged matters enormously. A charged molecule is surrounded by water and dissolves well, but it struggles to cross fatty cell membranes. A neutral molecule crosses membranes more easily but is often less water-soluble. So ionisation sits at the heart of a constant trade-off in drug behaviour between dissolving and being absorbed.
The fraction ionised at any pH is set by the drug's own pKa together with the local pH. As a rule of thumb, a weak acid becomes more ionised as pH rises (becomes more basic), while a weak base becomes more ionised as pH falls (becomes more acidic). This pH dependence is the basis of the pH-partition hypothesis and of strategies like salt formation to improve solubility.