When $R$ is noetherian, yes: By Baer's criterion it suffices to prove that the map
$\hom_{S^{-1} R}(S^{-1} R,S^{-1} M) \to \hom_{S^{-1} R}(J,S^{-1} M)$
is surjective for every ideal $J \subseteq S^{-1} R$. Write $J = S^{-1} I$ for some ideal $I \subseteq R$. Since $I$ (and of course $R$) are of finite presentation, this map is isomorphic to
$S^{-1} \hom_R(R,M) \to S^{-1} \hom_R(I,M),$
which is surjective since $\hom_R(R,M) \to \hom_R(I,M)$ is surjective.
The same proof also shows the converse: If $M$ is injective locally (either in the sense that all $M_{\mathfrak{p}}$ are injective over $R_{\mathfrak{p}}$, where $\mathfrak{p}$ runs through all prime ideals, or if there is a basic open cover $\mathrm{Spec}(R) = \cup_i D(f_i)$ such that each $M_{f_i}$ is an injective $R_{f_i}$-module), then $M$ is injective. See also here.
You can also see this as a consequence of the fact that the Ext functor, when restricted to f.g. modules over a noetherian ring, commutes with localization.