One can describe direct and inverse limits of sets (which correspond respectively to colimits and limits of a certain functor, $I\to Set$, $I^{op}\to Set$ respectively, where $I$ is a directed partially ordered set).
But we also want to describe those limits for algebras, such as groups, rings, modules etc.
For these algebras, the forgetful functor $U: \mathcal{C}\to Set$ ($\mathcal{C} = \mathbf{Grp}, \mathbf{Rng}, R-\mathbf{Mod}$, etc.) is right-adjoint to the "free-object" functor, and so naturally it commutes with limits, in particular the underlying set of a profuct of algebras is the product of the underlying sets, the terminal object (when it exists) has a singleton as underlying set, etc. And for inverse limits, it is also normal that the underlying set of the inverse limit of a system of algebras is the inverse limit of the underlying sets.
But $U$ has in general no right-adjoint and so isn't left adjoint; so there's no reason to expect that it'd commute with colimits. In fact, very often, it doesn't : in $\mathbf{Grp}$ the coproduct is the free product, in $R-\mathbf{Mod}$, it's the product, etc. And sometimes, colimits don't even exist (while they do in $Set$) : coproducts sometimes don't exist. (EDIT: As pointed out in the comments, this last remark is actually wrong; varieties of algebras are cocomplete)
However, direct limits (which are actually colimits, as I already mentioned) always exist in varieties of algebras which are the "natural" categories of algebras, and in these, $U$ commutes with said direct limits (see Grätzer, Universal Algebra for instance, for a treatment of direct and inverse limits), which feels like it's just a lucky thing.
But how lucky is it ? Is there a more general phenomenon that I'm not seeing that makes this happen or is it just "$U$ commutes with direct limits" ? Is there a more general class of colimits that are preserved by $U$ ?
If you have an adjunction where $F\colon \mathcal{C} \to \mathcal{D}$ is left adjoint to $U$, then $U\circ F$ is an monad. And the category of algebras over this monad is equivalent to $\mathcal{D}$.
If the monad $U\circ F$ preseves certain kind of colimits, then $U$ also does.
So in your case the monad would be the free functor, like free group, free $R$-module. So you just need to check that the free group functor commutes with certain colimits on the level of sets. (I.e. for groups: the colimit of sets over a poset $I$ is the same as the colimit of sets words in these sets over $I$.