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
There is no notion of infinite sum in a group without extra structure. You can sort of write stuff like this down heuristically but you need to be careful when reasoning with it. For example, the image of $g$ under a homomorphism is not determined by the image of the $a_i$. As an extreme example, the quotient $\prod G_i / \bigoplus G_i$ exists and is nonzero iff infinitely many of the $G_i$ are nontrivial.
On the other hand, we can say the following. The discrete groups $G_i$ can be given the discrete topology, and then their infinite product $\prod G_i$ can be given the product topology, which in the infinite case will not be discrete (again iff infinitely many of the $G_i$ are nontrivial). If the $G_i$ are finite then this topology makes the infinite product a profinite group; in general it's only a "prodiscrete" group. A sequence of elements of $\prod G_i$ converges in the product topology iff it converges pointwise, so it is actually meaningful and true to say that an element $g = (g_1, g_2, \dots )$ of the infinite product is the limit, in the product topology, of the sequence of "partial sums"
$$(g_1, e, e, e, \dots)$$ $$(g_1, g_2, e, e, \dots)$$ $$(g_1, g_2, g_3, e, \dots)$$
since this sequence converges pointwise to $g$. Be careful that if you want to use this to conclude anything about homomorphisms out of the infinite product $\prod G_i$ then you need to ask for them to be continuous with respect to the product topology; there are discontinuous ones in general.