The question is in the title. If the isomorphism $\mathrm{Hom}(A, G) \cong \mathrm{Hom}(B, G)$ is natural in $G$ then this is just the Yoneda Lemma. If $A$ and $B$ are finitely generated this is also true by the structure theorem.

However this sounds like it should be false in general, else it would imply by Yoneda that if $\mathrm{Hom}(A, -)$ and $\mathrm{Hom}(B, -)$ are (a priori not naturally) isomorphic, then they are also isomorphic in a natural way (though possibly by a different set of isomorphisms).

The question of course immeadiately generalizes to $R$-modules.

$$$$

**Edit:** *Some context (that isn't really relevant for the question)*

I'm interested in this question in light of the universal coefficient theorem for Cohomology. A positive answer would imply that knowing all Cohomology groups of a space, *with arbitrary coefficients*, would already determine its Homology (although I think it is conceivable that this topological statement can be proven in a different way).

2more comments