In general, the group $\mathbb Z_{mn}$ under addition $\bmod mn$ is isomorphic to the direct product $\mathbb Z_m \times \mathbb Z_n$ if and only if $\gcd(m,n)=1.$ This is easy to see since $\mathbb Z_{mn}$ is generated by the element $(1,1)$, and if $\gcd(m,n)=1$, then this will only be zero if it is multiplied by itself $mn$ times (resulting in the cyclic group).
However I'm interested in constructing an isomorphism between the two groups as an explicit expression. I've been playing around a bit with some examples, one of which is the function $\phi : \mathbb Z_2 \times \mathbb Z_3 \to \mathbb Z_6$ where $\phi(a,b) = 3a + 4b \pmod 6$, which gives us the desired isomorphism. I'm interested here in the relationship between the integers $2$, $3$, and the coefficients $3, 4$ of $a$ and $b$. After playing around in Wolfram|Mathematica, I managed to obtain the following isomorphisms $\phi_{m,n} : \mathbb Z_m \times \mathbb Z_n \to \mathbb Z_{mn}$ for coprime $m,n$ in $\{1, 2, \dots, 10\}$.
First of all, the following results seem to hold in general.
$$\phi_{1, n}(a, b) = a + b \qquad \text{for all $n$}$$ $$\phi_{m, 1}(a, b) = a + b \qquad \text{for all $m$}$$ $$\phi_{2, n}(a, b) = na + (n + 1)b \qquad \text{for all $n$}$$ $$\phi_{m, n}(a, b) = K a + L b \iff \phi_{n,m}(a, b) = L a + K b \qquad \text{for all $m, n$}$$
Beyond this point, I could not spot a general pattern. The isomorphisms I obtained are:
$$\phi_{3, 4}(a, b) = 4a + 9b$$ $$\phi_{3, 5}(a, b) = 10a + 6b$$ $$\phi_{3, 7}(a, b) = 7a + 15b$$ $$\phi_{3, 8}(a, b) = 16a + 9b$$ $$\phi_{3, 10}(a, b) = 10a + 21b$$ $$\phi_{4, 5}(a, b) = 5a + 16b$$ $$\phi_{4, 7}(a, b) = 21a + 8b$$ $$\phi_{4, 9}(a, b) = 9a + 28b$$ $$\phi_{5, 6}(a, b) = 6a + 25b$$ $$\phi_{5, 7}(a, b) = 21a + 15b$$ $$\phi_{5, 8}(a, b) = 16a + 25b$$ $$\phi_{5, 9}(a, b) = 36a + 10b$$ $$\phi_{6, 7}(a, b) = 7a + 36b$$ $$\phi_{7, 8}(a, b) = 8a + 49b$$ $$\phi_{7, 9}(a, b) = 36a + 28b$$ $$\phi_{7, 10}(a, b) = 50a + 21b$$ $$\phi_{8, 9}(a, b) = 9a + 64b$$ $$\phi_{9, 10}(a, b) = 10a + 81b$$ If you want to try and generate a few yourself, here is the Mathematica function I implemented. I'm sure it can be optimised, but for the first 10 coprime integers it sufficed.
isomorphism[{m_, n_}] :=
Module[{x = Null},
For[i = 1, i < m*n,
i++, (If[#[[2]] == Table[i, {i, 0, m*n - 1}],
x = ToString[#[[1]][[1]]] <> "a+" <> ToString[#[[1]][[2]]] <>
"b"; Break[]] &) /@
Table[{{i, j},
Mod[i #[[1]] + j #[[2]], m*n] & /@
Table[{Mod[i, m], Mod[i, n]}, {i, 0, m*n - 1}]}, {i, 1,
m*n}, {j, 1, m*n}][[i]]]; x];
I'd appreciate if anyone can help me find the pattern to determine $\phi_{m, n}$ in general.
If $m$ and $n$ are relatively prime then, by the extended Euclidean algorithm, we can find integers $u,v$ for which $1 = um + vn$. Then, it is not too hard to show that the mapping $\phi_{m,n} : \mathbb{Z}_m\times\mathbb{Z}_n\to\mathbb{Z}_{mn}$ given by $\phi_{m,n}(a,b)\mapsto vna+umb$ is an isomorphism.
It's a simple calculation (just use the definition) to check that $\phi_{m,n}$ defines a homomorphism. It is also trivial to check that this is a well-defined mapping.
To show it is an isomorphism, it suffices to check that it is injective, since $\mathbb{Z}_m\times\mathbb{Z}_n$ and $\mathbb{Z}_{mn}$ have the same size $mn$ But, if $\phi_{m,n}(a,b) = 0$, then we get $$0 = vna + umb = vna + (1-vn)b = b + n(va - vb),$$ which shows that $b\equiv 0\pmod{n}$. Similarly, $a\equiv 0\pmod{m}$.
The fact that $\mathbb{Z}_m\times\mathbb{Z}_n$ and $\mathbb{Z}_{mn}$ are isomorphic (even as rings), when $m$ and $n$ are relatively prime, is usually called the Chinese remainder theorem.