Assume that
$$G = \lim_{\substack{\longleftarrow\\i \in I}} G_i$$
for some inverse system $(G_i)_{i\in I}$. Then with $g = (g_i:i\in I)$,
$\lim_{n\in\mathbb{N}}g^{a_n}$ converges exactly when $\lim_{n\in\mathbb{N}} g_i^{a_n}$ converges for each $i\in I$. To this end, we need to show that there exists $N$ for which $g_i^{a_n} = g_i^{a_m}$ whenever $N \mid m, n$. Notice that we can take $N = \operatorname{ord}(g_i)$ since we have $a_n \equiv a_N \equiv a_m \pmod{N}$ in this case.
If $a = (a'_n+n\mathbb{Z}:n\in\mathbb{N})$ is another choice of representatives, then whenever $n$ divisible by $N = \operatorname{ord}(g_i)$ we have $a'_n \equiv a_n \pmod{N}$ and hence $g_i^{a_n} = g_i^{a'_n}$. This tells that the common value found in the previous step is independent of the choice of representatives.
This tells that $g^a = \lim_{n\in\mathbb{N}} g_i^{a_n}$ is well-defined. Showing that this map $a \mapsto g^a$ is homomorphism is now a routine work.
Perhaps a cleaner way of explaining this would be as follows:
Fix an element $g$ in $G = {\displaystyle\lim_{\longleftarrow}} G_i$ and define the map $\mathbb{Z}/n\mathbb{Z} \to G_i$ by $k+n\mathbb{Z} \mapsto g_i^k$ whenever $n$ is divisible by $\operatorname{ord}(g_i)$ (so that this map is well-defined). Then the following diagram commutes whenever all arrows make sense
$$\begin{array}{ccccc}
\hat{\mathbb{Z}} & \rightarrow & \mathbb{Z}/n\mathbb{Z} & \rightarrow & G_j \\
& \searrow & \downarrow & \searrow & \downarrow \\
& & \mathbb{Z}/m\mathbb{Z} & \rightarrow & G_i
\end{array}$$
where $\hat{\mathbb{Z}} \to \mathbb{Z}/n\mathbb{Z}$ are projections and vertical arrows are bonding maps.
Now let $\phi_i : \hat{\mathbb{Z}} \to G_i$ be the composition of $\hat{\mathbb{Z}} \to \mathbb{Z}/n\mathbb{Z} \to G_i$, which is well-defined and does not depend on the choice of $n$ by the above diagram. Then it follows that
$$\begin{array}{ccccc}
\hat{\mathbb{Z}} & \overset{\phi_j}{\rightarrow} & G_j \\
& \smash{\underset{\phi_i}{\searrow}} & \downarrow \\
& & G_i
\end{array}$$
commutes and hence (by the universal property of the inverse limit) there exists a unique map $\phi : \hat{\mathbb{Z}} \to G$ that makes the following diagram
$$\begin{array}{ccccc}
\hat{\mathbb{Z}} & \overset{\phi}{\rightarrow} & G \\
& \smash{\underset{\phi_i}{\searrow}} & \downarrow \\
& & G_i
\end{array}$$
commute. This $\phi$ coincides the map $a \mapsto g^a$ constructed by the limit.