Doubt on hypothesis of universal property of direct sum I have seen that the following theorem, known as universal property of the direct sum, is always stated for direct sums of abelian groups:

(Universal mapping property of external direct sum): let
  $\{G_{s} | s \in S\}$ be a nonempty set of abelian groups, and let $\bigoplus_{s\in S}G_{s}$ be the external direct sum, the associated group homomorphisms being the embedding mappings $i_{s_0} : G_{s_0} → \bigoplus_{s\in S}G_{s}$. If $H$ is any abelian group and $\{\phi_{s} ~\mid~ s \in S\}$ is a system of group homomorphisms $\phi_{s} : G_{s} → H$, then there exists a unique group homomorphism $\phi :\bigoplus_{s\in S}G_{s} → H$ such that $\phi \circ i_{s_0} = \phi_{s_0}$ for all $s_{0}\in S$.

What I do not get is the following: while on one hand the proof of the theorem looks to me not to depend on the commutativity of the family of groups (but I might have missed it), on the other hand it is always stated for direct sums of abelian groups.
Is there an example or a general principle showing what could go wrong if we drop the hypothesis?
Have a nice day!
 A: The apparent issue comes from your statement of the Universal Property, and by clarifying that statement, we will see that the issue resolves itself.
In a fixed category $\mathcal{C}$, we define the Coproduct of two objects $A$ and $B$ to be


*

*an object $A + B$

*$\iota_A : A \to A+B$

*$\iota_B : B \to A+B$
satisfying the following Universal Property:

For all pairs of maps $\varphi : A \to C$, $\psi : B \to C$, there is a unique map
  $\varphi + \psi : A + B \to C$ so that 
  
  
*
  
*$\varphi = (\varphi + \psi) \circ \iota_A$
  
*$\psi = (\varphi + \psi) \circ \iota_B$

Now, in the category of Abelian Groups (Ab), one can check that $A \oplus B$ is the coproduct of $A$ and $B$ (interestingly, it is also the product). However, the direct product of two groups does not satisfy the universal property of the coproduct. Indeed, that is why we don't call it a direct sum anymore.
I encourage you to work out the following example to see why this isn't the case:

Let $\mathfrak{S}_3$ be the symmetry group on $3$ letters.
  
  
*
  
*$\varphi : \mathbb{Z} \to \mathfrak{S}_3$ sending $1 \mapsto (1 2)$
  
*$\psi : \mathbb{Z} \to \mathfrak{S}_3$ sending $1 \mapsto (2 3)$
  
*yet there is no map $\varphi + \psi : \mathbb{Z} \oplus \mathbb{Z} \to \mathfrak{S}_3$ satisfying the above condition.
  

The issue, I'm sure you'll find, is that $(1,0)$ and $(0,1)$ commute in $\mathbb{Z} \oplus \mathbb{Z}$, but their images under $\varphi$ and $\psi$ don't commute in $\mathfrak{S}_3$. 
But the universal property as you stated in your question restricts the codomain to be abelian groups, which completely sidesteps this problem. If we are only working with abelian groups, this is great! But in the category of all groups, such arbitrary restrictions on the codomain aren't allowed.
Hope is not lost, though! There is a coproduct in the category of all groups. It is called the free product, and is extremely interesting, though I'm afraid this answer is already getting a bit long.
As a parting word, there is also categorical justification for your observation that, when restricting the codomain to abelian groups, the direct sum approach stil works.  Using only group theory, one could verify that the direct sum of abelianizations of groups is the same thing as the abelianization of their free product. At a slightly higher level of abstraction, the abelianization "functor" is a left adjoint. As such, it preserves coproducts, as you have noticed.

I hope this helps ^_^
A: Let $G_1,G_2$ be two groups. The universal property of their coproduct may be stated as the following

The coproduct of $G_1,G_2$ is an object $G_1+G_2$ together with a pair of inclusions $\iota_1\colon G_1\to G_1+G_2$, $\iota_2\colon G_2\to G_1+G_2$ such that for every pair of group homomorphisms $f_1\colon G_1\to H$, $f_2\colon G_2\to H$ there exists a unique group homomorphism $\sigma\colon G_1+G_2\to H$ such that $\sigma\circ\iota_1=f_1$ and $\sigma\circ\iota_2=f_2$.

For comparision, the universal property of their product is given by

The product of $G_1,G_2$ is an object $G_1\times G_2$ together with a pair of projections $\pi_1\colon G_1\to G_1+G_2$, $\pi_2\colon G_2\to G_1+G_2$ such that for every pair of group homomorphisms $f_1\colon G_1\to H$, $f_2\colon G_2\to H$ there exists a unique group homomorphism $\sigma\colon H\to G_1\times G_2$ such that $\pi_1\circ\sigma=f_1$ and $\pi_2\circ\sigma=f_2$.

In both cases the given group homomorphisms factor through the (co)product in one or another way. What makes abelian groups special: for finitely many groups $G_1,\dots, G_n$ their product and coproduct coincide and we call the the defined object their direct sum.

Consider two groups $G_1,G_2$ and their set-theoretic cartesian product (which, by the way, is also the product of two set in the universal sense as above). Define the projection arrows by  
$$\pi_1\colon G_1\times G_2\to G_1,~(g_1,g_2)\mapsto g_1,~~~\pi_2\colon G_1\times G_2\to G_2,~(g_1,g_2)\mapsto g_2$$
And for two given maps $f_1\colon H\to G_1$, $f_2\colon H\to G_2$ let $\sigma(x)=(f_1(x),f_2(x))$ for all $x\in H$ which guarentees $\pi_1\circ\sigma=f_1$ and $\pi_2\circ\sigma=f_2$. I leave it to you to show that this morphism is unique as mere set-function. Equip the cartesian product with componentwise composition making it a group. It remains to show that $\sigma$ is then in fact a group homomorphism. For this let $x,y\in H$ and observe
\begin{align*}
\sigma(xy)=(f_1(ab),f_2(ab))&=(f_1(a)f_1(b),f_2(a)f_2(b))\\
&=(f_1(a),f_2(a))\circ(f_1(b),f_2(b))\\
&=\sigma(x)\circ\sigma(b)
\end{align*}
This argument works out for all groups and thus we can form their categorical product. However, let $G_1,G_2$ be abelian and consider their product (or just cartesian product). Define the inclusion arrows by
$$\iota_1\colon G_1\to G_1\times G_2,~g_1\mapsto(g_1,1),~~~\iota_2\colon G_2\to G_1\times G_2,~g_1\mapsto(1,g_2)$$
Here $(1,1)$ is the identity of $G_1\times G_2$ under componentwise composition. For two given maps $f_1\colon G_1\to H$, $f_2\colon G_2\to H$ let $\sigma(x)=f_1(x)f_2(x)$ for all $x\in G_1\times G_2$. By construction $\sigma\circ\iota_1=f_1$ and $\sigma\circ\iota_2=f_2$ and you can have some fun by showing this map is unique etc. (actually, do it once in set and you are happy for a lifetime). Now, the tricky thing: show that $\sigma$ as defined is a group homomorphism. Let $x,y\in G_1\times G_2$, then
\begin{align*}
\sigma(xy)=f_1(xy)f_2(xy)&=[f_1(x)f_1(y)][f_2(x)f_2(y)]\\
&\color{red}=\color{red}{[f_1(x)f_2(x)][f_1(y)f_2(y)]}\\
&=\sigma(x)\sigma(y)
\end{align*}
So we can form their categorical coproduct of any two abelian groups just by equpping their product with suitable inclusions. However, note that the crucial transition was to the emphasized line, which would not be possible if not $f_1(y)f_2(x)=f_2(x)f_1(y)$; that is, if $H$ were not abelian.   
If we take two arbitrary, possible non-abelian groups we cannot just define $\sigma$ as straightforward as in the abelian case and the internal structure of the free product, i.e. the coproduct, of two groups is different (basically, all becomes more complicated; see here for some explanations).


Consider the direct product of $\mathcal C_2$ and $\mathcal C_3$: $\mathcal C_2\times\mathcal C_3$. Then $\mathcal C_2\times\mathcal C_3$ is not a coproduct of groups 

Here $\mathcal C_2,\mathcal C_3$ are cyclic groups. It is, of course, if we consider $\mathcal C_2,\mathcal C_3$ as abelian groups, but then we would only allow pairs of maps $f_1\colon\mathcal C_2\to H$, $f_2\colon\mathcal C_3\to H$ with $H$ abelian. Dropping this hypothesis, consider $H=S_3$.  
You can embed $\mathcal C_2,\mathcal C_3$ into $S_3$ in a canonical way by sending $[1]_2\in\mathcal C_2$ to a transposition and $[1]_3\in\mathcal C_3$ to a $3$-cycle. Take these embeddings $\iota,\overline{\iota}$ and assume $\mathcal C_2\times\mathcal C_3$ is a coproduct. Then there would exist a (unique) group homomorphism $\sigma\colon\mathcal C_2\times\mathcal C_3\to S_3$ making everything commute (i.e. satisfying the universal property from above). You can from here derive that this would imply $\sigma(x,y)=\iota(x)\overline{\iota}(y)=\overline{\iota}(x)\iota(y)$ for all $x\in\mathcal C_2,y\in\mathcal C_3$; take $x=[1]_2$ and $y=[1]_3$ and derive a contradiction (two commuting elements in $S_3$ which do not commute as it can be verified by computation). Thus, the direct product $\mathcal C_2\times\mathcal C_3$ of $\mathcal C_2,\mathcal C_3$ is not their coproduct.   
The free product of $\mathcal C_2,\mathcal C_3$ can be constructed by taking two generators $x,y$ and force them to fulfill $x^2=1,y^3=1$ only. This group consists of all 'words' of the form $xy^2yxy^2x$ etc. and, as I said, is a little bit more chaotic if you want.
This is exercise ${\rm II}.3.5$ in P. Aluffi's: Algebra Chapter 0 and the idead of the proof is taken from these notes

The concepts of product and coproduct can be generalized to arbitary categories by just appealing to the universal properties given. Looking the other way around: we can view the direct sum (or the direct product, or the disjoing union, etc. pp.) as particular objects with particular desirable properties defined by the respective universal properties; not as objects which happen to satisfy such and such a property.
We define the direct sum (the direct product, the disjoint union) such that they do exactly what we want; and what we want is encoded in the universal property. Maybe this helps to gain some intuition.
