It holds always since you can show that
$$ S^{-1} H_i(C) \cong H_i (S^{-1}C)$$
where $H_i$ denotes the $i$-th homology group and $C$ the chain complex you're taking homology of.
To see that taking homology commutes with taking fractions let $$ A \xrightarrow{f} B \xrightarrow{g} C$$ be a sequence of $R$-modules such that $gf = 0$ and $S \subset R$ is multiplicative.
We claim that $S^{-1}(\mathrm{ker}g / \mathrm{im} f) \cong (S^{-1} \mathrm{ker}g )/ (S^{-1} \mathrm{im} f) \cong (\mathrm{S^{-1} ker}g )/ (\mathrm{S^{-1} im} f)$ from which our claim above will follow.
We know that $S^{-1}$ is an exact functor (Atiyah-Macdonald, p. 39, Prop. 3.3). Also, the following sequence is exact:
$$ 0 \to \mathrm{ker} g \hookrightarrow B \xrightarrow{g} C$$
and hence the following sequence is also exact
$$ 0 \to S^{-1}\mathrm{ker} g \hookrightarrow S^{-1}B \xrightarrow{S^{-1}g} S^{-1}C$$
so that we get $S^{-1}\mathrm{ker} g \cong \mathrm{ker} S^{-1}g$.
Similarly, $$ A \xrightarrow{f} \mathrm{im} f \to 0$$ is exact so that $$ S^{-1}A \xrightarrow{S^{-1}f} S^{-1} \mathrm{im} f \to 0$$ is also exact and hence $\mathrm{im} S^{-1}f \cong S^{-1} \mathrm{im}f$.
So that we have $$ (S^{-1} \mathrm{ker}g )/ (S^{-1}\mathrm{im}f) \cong (\mathrm{ker} S^{-1}g ) / (\mathrm{im} S^{-1} f) $$
To finish the proof you use that
$$ 0 \to \mathrm{im}f \to \mathrm{ker}g \to (\mathrm{ker}g) / ( \mathrm{im}f) \to 0$$ is exact so that
$$ 0 \to S^{-1}\mathrm{im}f \to S^{-1} \mathrm{ker}g \to S^{-1}( (\mathrm{ker}g) / ( \mathrm{im}f) ) \to 0$$ is exact and hence
$$ S^{-1}( (\mathrm{ker}g) / ( \mathrm{im}f) ) \cong (S^{-1} \mathrm{ker}g) / (S^{-1}\mathrm{im}f) \cong (\mathrm{ker} S^{-1} g) / (\mathrm{im}S^{-1} f)$$
which proves the claim.