Let me elaborate on Tsemo Aristide's anwser that the direct sum of abelian groups should be replaced by the so-called free product for non-abelian groups.
When we want to compare a construction from the theory of abelian groups with the situation of general groups, we first need a way of comparing the class of abelian groups with the class of groups in general. The usual way of doing this is to use categories. A category is just a collection of objects, together with special 'maps' between them (note that I'm glossing over a whole lot of details here, but the Wikipedia page on categories has a lot of information). For instance, there is the category of groups (with group homomorphisms as maps), the category of $\mathbb{R}$-vector spaces (with linear maps), the category of sets (with no restriction on the maps), etc.
In our case, we want to compare the category of groups with the category of abelian groups, and somehow transfer the notion of a direct sum from the latter to the former. To do that, we first need to express the direct sum in the language of categories, i.e. just refering to objects (abelian groups) and maps (group homomorphisms), and in particular without refering to elements of the groups involved. That may seem close to impossible at first glance, but it can be done using the following trick.
First, we notice that if $(A_i)_{i\in I}$ is any collection of abeliqn groups, then for any other abelian group $B$ there is a very natural (set-theoretic) bijection
$$\textrm{Hom}(\oplus_{i \in I} A_i, B) \to \prod_{i \in I}\textrm{Hom}(A_i, B),$$
where $\oplus_{i \in I} A_i$ is the direct sum of the $A_i$ (you should at this point take the time to write down which map this is, and convince yourself that this map is indeed bijective). In words, this says that a homomorphism from $\oplus_{i \in I} A_i$ to $B$ and a collection of morphisms from every $A_i$ to $B$ are 'the same thing'. In fact, it turns out that the direct sum is unique with this property: if $A$ is any abelian group such that for any abelian group $B$ we get a natural bijection like above, then $A$ is isomorphic to $\oplus_{i \in I} A_i$. So this gives us precisely a characterisation of the direct product in terms of just the groups and the homomorphisms.
Now that we know what a direct sum looks like in the category of abelian groups, we can try doing the same for general groups. So given a collection $(G_i)_{i \in I}$ of not necessarily abelian groups, we want to find a group $G$ with the property that for any group $H$, there is a natural bijection
$$\textrm{Hom}(G, H) \to \prod_{i \in I}\textrm{Hom}(G_i, H).$$
Based on the abelian case, we might expect that this group $G$ should be the direct product of the $G_i$, or perhaps the subset of the direct product $G_i$ of sequences with only finitely many non-identity components, but unfortunately these groups do not satisfy the above condition (you should verify this by finding some explicit examples of sets $I$ and groups $G_i$ and $H$ for which we do not have a bijection like above). The group that does satisfy the condition is the one called the free product of the $G_i$. This group is formed by considering finite words, where the letters are taken from all the sets $G_i$, and we may simplify words by multiplying two adjecent letters if they come from the same $G_i$, and we may remove any identity elements from the words (see the wiki page for a more precise definition). It is a nice exercise to show that in the case that all the $G_i$ are abelian, the direct sum of the $G_i$ is isomorphic to the abelianization of the free product, so the free product is indeed a generalization of the direct sum.
So we see that the 'correct' translation of the direct sum concept to general groups leads to free products, instead of cartesian products or subsets thereof. In other words, there is not a problem with considering 'direct sums' of non-abelian groups per se, but to preserve the properties that the direct sum has in the abelian case, we need to consider the free product instead of a direct sum.
Best Answer
Okay, just looked at the book. So for each pair of indices $i$ and $j$; we have a family $F_{ij}$ of morphisms. Far be it for me to correct Serre, so let me instead point out that most people would not call this construction a "direct limit", but rather a colimit. "Direct limit" is usually restricted for the case where $I$ is a directed set (partially ordered set in which every finite subset has an upper bound), and where for each $i$ and $j$, if $i\nleq j$ then $F_{ij}$ is empty; if $i\leq j$ then $F_{ij}=\{f_{ij}\}$ is a singleton; $f_{ii}=\mathrm{Id}_{G_i}$; and the morphisms are requied to satisfy $f_{ik} = f_{jk}\circ f_{ij}$ whenever $i\leq j\leq k$.
I don't think you are reporting the example correctly: the index set is not "$[2]$" as you report (by which I suspect you mean $\{1,2\}$). Here is what he says, explicitly:
So, here your index set has three elements: $1$, $2$, and then a silent index used for $A$. I would denote it by $G_0=A$. Then you have $F_{01}=\{f_1\colon A\to G_1\}$; $F_{02}=\{f_2\colon A\to G_2\}$; and $F_{10}=F_{20}=F_{12}=F_{21}=\varnothing$. In other words, you entire system consists of exactly three groups and exactly two maps, and nothing else. Then you take the colimit/direct limit of this system, and you get the free product of $G_1$ and $G_2$ amalgamated over $A$.
Note that $f_1$ and $f_2$ are not assumed to be embeddings; that's why the amalgamated product could be trivial.
Your $S$ and $T$ are misguided. If $G_1$ were generated by $S$ and you had a bijection from a subset of $A$ onto $S$ with the restriction of a homomorphism, then the homomorphism would be onto.
The "classic" situation is when $f_1$ and $f_2$ are embeddings, so that $A$ can be identified with a "common" subgroup of $G_1$ and $G_2$; in that case, $G_1*_A G_2$ is defined as $G_1*G_2/N$, where $G_1*G_2$ is the free product, and $N$ is the smallest normal subgroup of $G_1*G_2$ containing all elements of the form $f_1(a)f_2(a)^{-1}$; it is then necessary to prove that this results in a group that contains isomorphic copies of $G_1$ and $G_2$, which intersect precisely "at" $A$. In the more general situation here, where $f_1$ and $f_2$ are not required to be monomorphisms/injective, this is what is usually called a pushout of $f_1$ and $f_2$; that is, you have a diagram $$\require{AMScd} \begin{CD} A@>f_1>>G_1\\ @Vf_2VV\\ G_2 \end{CD}$$ and then you seek a universal group $G$ and maps $g_1,g_2$ that fits into the diagram as follows: $$\begin{CD} A@>f_1>>G_1\\ @Vf_2VV@VVg_1V\\ G_2@>g_2>>G \end{CD}$$ so that $g_1f_1=g_2f_2$ and satisfies the relevant universal property relative to that condition.