How to get a group from a semigroup

What you are describing is the left adjoint of the forgetful functor from Group to Semigroup.

In the case of monoids and monoid homomorphisms, such a group is called the enveloping group of a monoid. You can find the description in George Bergman's Invitation to General Algebra and Universal Constructions, Chapter 3, Section 3.11, pages 65 and 66.

However, you don't always get embeddings.

For semigroups, the most natural thing is to adjoin a $1$, even if the semigroup already has one, and then perform the construction. If $S$ already had an identity, the construction will naturally collapse the new, adjoined, identity into the original one, and give you "the most general group into which you can map the semigroup".

Added. In fact, what the last construction is doing (for semigroups) is simply composing the two right adjoints: the right adjoint of the forgetful functor from Monoid to Semigroup is the functor that adjoins an identity (since even between monoids there are generally more semigroup homomorphisms than monoid homomorphisms). So if we look at the composition of the forgetful functors Group $\longrightarrow$ Monoid $\longrightarrow$ Semigroup, we obtain a right adjoint by composing the adjoints going the other way, Semigroup $\longrightarrow$ Monoid (adjoin a $1$), and Monoid $\longrightarrow$ Group (enveloping group). So: first adjoin a $1$, then construct the enveloping group.

(Interestingly, there is another functor from monoids to groups, namely the functor that assigns to every monoid its group of units, $M^*$. This functor is the right adjoint of the forgetful functor: given any monoid $M$ and any group $G$, there is a natural corespondence between $\mathbf{Monoid}(G,M)$ and $\mathbf{Group}(G,M^*)$).


Update: I was initially wrong thinking that Grothendieck construction can be applied for any semigroup. Below a corrected version of my post.

If you start from a commutative monoid there is an easy way to construct a group, called Grothendieck construction. See http://en.wikipedia.org/wiki/Grothendieck_group. By the way, it's not always true that the monoid embeds into its Grothendieck group, but it suffices that it verifies the cancelation property: $a+b=a+c$ implies $b=c$.