To begin with: a necessary and sufficient condition for $(g_i,h_i)_{i\in I}$ to be free is that either $(g_i)_{i\in I}$ or $(h_i)_{i\in I}$ is free.
It is obviously sufficient. Let us check it's necessary; the case when $I$ is a singleton being straightforward (to say that a singleton family is free means that its single element has infinite order), assume it has at least 2 elements. If none of the two families is free, there exist nontrivial group words (in the free group over $I$), say $w,w'$ such that $w((g_i)_{i\in I})=1$ and $w'((h_i)_{i\in I})=1$. Since $I$ has at least 2 elements, there exists a conjugate of $w'$ (say, by some generator) that does not commute with $w$. Then possibly replacing $w'$ with this conjugate and then considering $w''=[w,w']$, we have $w''((g_i,h_i)_{i\in I})=1$ and $w''\neq 1$.
Now I answer the question, which regards freeness of arbitrary cyclic groups (recall that, by definition, a family $(H_i)$ of subgroups of a group $G$ is free if the canonical homomorphism from the free product of the $H_i$ into $G$ is injective).
Define $\gamma_i=(g_i,h_i)$; assume that no $\gamma_i$ equals 1 and that $I$ has at least 2 elements. For $g$ in a group, define $o(g)$ to be the order of $g$ (0 if $g$ is not torsion).
A necessary and sufficient condition for $(\langle(g_i,h_i)\rangle)_{i\in I}$ to be free is that either $o(h_i)$ divides $o(g_i)$ for all $i$ and $(\langle g_i\rangle)$ is free, or vice versa.
It is obviously sufficient. Otherwise, first assume that the divisibility property fails. Hence there exist indices $i,j$ and positive integers $k,\ell$ such that $g_i^k=1$, $h_i^k\neq 1$, $h_j^\ell=1$, $g_j^\ell\neq 1$. Then $\gamma_i^k\neq 1$, $\gamma_j^\ell\neq 1$, but $[\gamma_i^k,\gamma_j^\ell]\neq 1$, hence $(\langle\gamma_i\rangle)_{i\in I}$ is not free.
Otherwise we have, up to switching: $o(h_i)$ divides $o(g_i)$ for all $i$ (which forces $g_i\neq 1$ for all $i$ since $\gamma_i\neq 1$ was assumed), but the condition fails, which means that there exists nontrivial words $w,w'$ in the free product of cyclic groups ${\large\ast}_i\mathbf{Z}/o(g_i)\mathbf{Z}$ such that $w((g_i)_{i\in I})=1$ and $w'((h_i)_{i\in I})=1$. Indeed, define $w''$ to be the commutator of $w$ and $w'$, where $w'$ is possibly replaced with a conjugate if it accidentally () commutes with $w$; then $w''((\gamma_i)_{i\in I})\neq 1$ and it follows that $(\langle\gamma_i\rangle)_{i\in I}$ is not free. For () to work I need the fact that the centralizer of any nontrivial conjugacy class is trivial, a fact that holds in an arbitrary nontrivial free product with the unique exception of the infinite dihedral group.
(*) this fails when $I$ has only 2 elements $i,j$ and both $g_i,g_j$ have order 2 (hence $h_i^2=h_j^2=1$ as well by the divisibility assumption); then a stupid argument works: if both $(g_1,g_2)$ and $(h_1,h_2)$ are non-free, then both $\{g_1,g_2\}$ and $\{h_1,h_2\}$ generate finite groups, hence so does $\{\gamma_1,\gamma_2\}$ and hence $(\gamma_1,\gamma_2)$ is not free.