Is there a generalization of the free group that includes infinitely long words?
This doesn't work if you just do it naively. The most naive definition of an "infinite word" would be an infinite string $s_1s_2s_3\dots$ where each $s_n$ is an element of $S$ or the formal inverse of an element of $S$. This fails horribly, since such strings are not closed under composition or inverses. For instance, the inverse of such an infinite string would be infinitely long on the left, instead of on the right. And if you concatenate two such infinite strings, you would get a string of the form $(s_1s_2s_3\dots)(t_1t_2t_3\dots)$ where the "letters" in the word are now arranged in a sequence indexed by the ordinal $\omega+\omega$, instead of just by the natural numbers. So, to make sense of this idea, you need to allow a more exotic variety of "infinite words" that can have many different infinite totally ordered sets as their index sets.
Another important obstacle is the Eilenberg swindle. Namely, let $s\in S$ (or more generally let $s$ be any word) and consider the infinite word $w=sss\dots$. Then any reasonable definition of a "group of infinite words" should have $sw=w$, which then implies $s=1$! So if you want your group to be nontrivial, you need to impose some restriction that disallows words of this type.
However, the news is not all bad! There does exist at least one interesting construction of a "free group with infinite words" (there are probably others too; I don't know the literature on this subject). You can find the details in Section 3 of the nice paper The Combinatorial Structure of the Hawaiian Earring Group by J. W. Cannon and G. R. Conner. Specifically, Cannon and Conner define a "transfinite word" on a set $S$ to be a map $f:I\to S\cup S^{-1}$ where $I$ is a totally ordered set, $S^{-1}$ is the set of formal inverses of elements of $S$, and each fiber of $f$ is finite. So, you can have a word indexed by any totally ordered set, as long as each element of $S$ only appears in it only finitely many times (this finiteness condition avoids Eilenberg swindles). Two words $f:I\to S\cup S^{-1}$ and $g:J\to S\cup S^{-1}$ are identified if there is an order-isomorphism $I\cong J$ which turns $f$ into $g$. They then define an equivalence relation on such words using a sort of cancellation, prove that each word is equivalent to a unique "reduced" word, and use this to define a "big free group" on $S$ consisting of transfinite words modulo equivalence (or equivalently, reduced transfinite words).
When $S$ is countably infinite, this group is isomorphic to the fundamental group of the Hawaiian earring. Sadly, this construction is only really of interest when $S$ is infinite, since when $S$ is finite all words must be finite and you just get the ordinary free group.
You can consider the profinite completions $\widehat{F_n}$ of the free groups. These allow some infinite words, to the left or right or both, but not all. For example, $aba^{2!} b^{2!} a^{3!} b^{3!} \dots$ is an element of $\widehat{F_2}$, but $ababab \dots$ isn't.