The anomalies in four dimensions are calculated from a triangular Feynman diagram with a chiral (left-right-asymmetric, when it comes to the couplings with the gauge bosons or gravitons) fermion running in the loop and three gauge bosons (and/or graviton[s]) attached at the vertices. For the Standard Model, all the gauge anomalies cancel (both leptons and quarks must be included, otherwise it wouldn't work: it's somewhat nontrivial although the cancellation may be reduced to one simple observation in GUT theories, among other fast methods to see why it works). They must also cancel in the supersymmetric models and in order to see what these anomalies are, we may look at the difference between the anomalies in the non-supersymmetric and supersymmetric models.
The Minimal Supersymmetric Standard model has almost the same spectrum of chiral spin-1/2 particles, the quarks and leptons: their anomalies cancel. Their new superpartners are scalars which don't contribute to the anomaly. The new superpartners of gauge bosons are Majorana fermions which are left-right-symmetric and contribute zero to the anomalies, too.
The only new particles in the supersymmetric theory that may be running in the loop that contribute to the anomaly are higgsinos, the superpartners of the Higgs boson (the whole doublet). The anomaly (for various combinations of gauge bosons) from one higgsino, one new Weyl fermion, is nonzero. It must be cancelled because gauge anomalies are inconsistencies (preventing us from decoupling negative-probability time-like polarizations of gauge bosons).
So the MSSM deals with that by adding two opposite higgsinos whose charges are opposite to each other so all the anomalies cancel in between them.
There's one more supersymmetric reason why we need two Higgs doublets: the Yukawa couplings must be holomorphic, arising from a superpotential $W=y\cdot h \bar q_L q_R$, and when one distinguishes chiral superfields and antichiral superfields (their complex conjugate), he finds out that only the up-type quarks (or only the down-quark quarks) could get masses from one Higgs doublet (the charges wouldn't add up to zero if you added the opposite quarks). So the opposite, complex conjugate Higgs doublet superfield (whose higgsinos have the opposite handedness for the same sign of the supercharge and the weak isospin) is needed to give masses to the remaining one-half of the quarks.