To provide a tad more explanation to what suresh1 says in his reply, since the mechanism here is as simple as it is fundamental to all things supersymmetric and indextheoretic:
It is a general fact that "the partition function of a supersymmetric system is a topological invariant". This was first discovered in the context of supersymmetric quantum mechanics, where the phenomenon is most clearly visible, but precisely the same general mechanism controls all supersymmetric quantum field theories and string theories, too.
Namely,consider a system with Hamiltonian \(H\) that "has a supercharge" hence for which there is an oddgraded selfadjoint operator \(D\) such that \(H = \tfrac{1}{2}\{D,D\} = D^2\)
Then consider the Euclideanized partition function of the system
\(Z_t = \mathrm{sTr}(\exp(t H))\)
where we take the supertrace, hence the trace over evengraded states minus that over oddgraded states.
Now the point to notice is that all eigenstates of H of nonvanishing eigenvalue appear in “supermultiplet” pairs of the same eigenvalue: if \(\psi\rangle\) has eigenvalue E>0 under H, then

\(D \psi\rangle \neq 0\);

also \(D \psi\rangle\) has eignevalue E (since [H,D]=0).
Therefore all eigenstates for nonvanishing eigenvalues appear in pairs whose members have opposite sign under the supertrace. So only states with \(H \psi\rangle = 0\) contribute to the supertrace. But if H and D are hermitean operators for a nondegenerate inner product, then it follows that \((H \psi\rangle = 0) \Leftrightarrow (D\psi\rangle = 0)\) and hence these are precisely the states which are also annihilated by the supercharge (are in the kernel of D), hence are precisely only the supersymmetric states.
On these now the weight \(\exp(t D^2) = 1\) and hence the supertrace over this “Euclidean propagator” simply counts the number of supersymmetric states, signed by their fermion number.
Notice that this result is "topological" in that it does not actually depend on the geometric background encoded by the Hamiltonian (it's energy spectrum and hence the couplings which this encodes) In particular it does not depend on the worldline length t itself.
It seems that this simple argument goes back at least all the way to
 H. MacKean, Isadore Singer, Curvature and eigenvalues of the Laplacian, J. Diff. Geom. 1 (1967)
It became popular with the advent of supersymmetric quantum mechanics due to
 Luis AlvarezGaumé, Supersymmetry and the AtiyahSinger index theorem, Comm. Math. Phys. Volume 90, Number 2 (1983), 161173. (Euclid)
In the mathematics literature this was then picked up in
 Ezra Getzler, Pseudodifferential operators on supermanifolds and the AtiyahSinger index theorem, Comm. Math. Phys. 92 (1983), 163178. (pdf)
and so today a standard textbook account for this is
(see around prop. 3.48, 350). Mathematicians speak of the "heat kernel technique for index theory" or the like. For more see on the nLab at index.
Now to come to the string: superstring propagation may be thought of as essentially being supersymmetric quantum mechanics on loop space (this is how Witten was brought to supersymmetric QM in the first place). The Dirac operator now is the DiracRamond operator. The partition function of the superstring is hence formally directly analogous, just richer, to the above. In particular if a sector has a supercharge, then only the supersymmetric ground states contribute to the partition function.
In particular for the type II superstring in the NSR sector or else for the heterotic string, of the two possible worldsheet DiracRamond supercharges only one exists (the rightmoving one, say). Hence the partition function of the superstring in this case  called the Witten genus  may be thought of as being a generating functional for counting of onehalf supersymmetric string states, by precisely the above kind of argument.
But onehalf supersymmetric string states have an important interpretation in terms of the effective target space supergravity theory: theory are the BPSstates. Hence the partition function of the onehalfsupersymmetric superstring (type II in NSR sector else heterotic) counts BPSstates in target space.
Lecture notes expanding on this include for instance
This is finally where the black hole entropy comes in: suitably extremal black holes in supergravity (= strongly coupled strings) correspond indeed to BPS states in the weakly coupled theory (certain halfsupersymmetric Dbrane configurations). The former are counted by the Witten genus. But since  by the above argument  that does not actually depend on "geometric" data such as the coupling constant, one knows that it remains the same even in the strong coupling regime in which there is a black hole.
This is what one means when one says that BPS states are "protected" from changes of the coupling constant.
More pointers are on the nLab at black holes in string theory