Localization commutes with arbitrary direct sums
Might not be exactly what you want, but you only need to understand the following fact:
The localization $S^{-1}M$ is canonically isomorphic to the tensor product $S^{-1}A \otimes_A M$, as $S^{-1}A$-modules.
The question is then nothing but the fact that tensor product commutes with arbitrary direct sums (see e.g. this wiki page "distributive property").
Similarly as you have constructed the map, you can show that $\bigoplus_i S^{-1}M_i$ satisfies the universal property of $S^{-1}\bigoplus_i M$, which is just the combination of the universal property of localisation and the direct sum. This can be done 'by hand', which usually involves a large diagram, or as follows, if you are confident with functors:
We have the following sequence of natural equivalences of functors from the category of $S^{-1}A$-modules to the category of sets, given by various universal properties: $$\begin{align*} \hom_{S^{-1}A}(S^{-1}M,-) &= \hom_A(M,-|_A)\\ &=\prod\nolimits_i \hom_A(M_i,-|_A)\\ &=\prod\nolimits_i \hom_{S^{-1}A}(S^{-1}M_i,-|_A)\\ &= \hom_{S^{-1}A}\left(\bigoplus\nolimits_i S^{-1}M_i,-\right),\\ \end{align*}$$ where $-|_A$ means restriction of the $S^{-1}$-module structure to $A$.
This is the same as saying that their universal properties are equivalent; formally, one should invoke the Yoneda Lemma to conclude the claim. Tracing through the isomorphisms also tells you how to construct the isomorphisms if you plug in $S^{-1}M$ or $\bigoplus\nolimits_i S^{-1}M_i$ and look where the identity goes. And this shows that the map you've constructed is indeed the natural isomorphism.