Under fairly general exactness assumptions on the ambient category, one can perform the construction of a group from $(T,m)$, if $T$ is an object equipped with a heap structure $m:T^3\to T$, i. e. an associative Maltsev operation. That is, $m$ must just satisfy (diagrammatic versions of) $m(x,x,y)=m(y,x,x)=y$ and $m(m(x,y,z),t,u)=m(x,y,m(z,t,u))$.

This is done exactly as one does construct a vector space from an affine space:
one gets a group as a quotient $T\times T\twoheadrightarrow G$ (which becomes the division map of the torsor $T$ over $G$, $(x,y)\mapsto x/y$ where $x/y$ is the unique element of $G$ with $(x/y)y=x$).

The quotient is by identifying $(x,y)$ with $(m(x,y,z),z)$ for all $x,y,z$. That is, one forms the coequalizer $T^3\rightrightarrows T^2\twoheadrightarrow G$ of appropriate morphisms.

The action of $G$ on $T$ is determined by $(x/y)\cdot z=m(x,y,z)$, and gives a $G$-torsor. It is an easy exercise to do this "without elements". Moreover any other group over which $T$ is a torsor and such that $m(x,y,z)$ is $(x/y)\cdot z$ for that structure too, is isomorphic to $G$, by an isomorphism compatible with the actions on $T$.

In fact switching sides one also has another group $G'$ such that $T$ is a $G$-$G'$-bitorsor.

This even works without global support assumption: defining support $S$ of $T$ as the coequalizer $T\times T\rightrightarrows T\twoheadrightarrow S$ of the projections $T\times T\rightrightarrows T$, one gets a group and a torsor structure in the slice category over $S$.

There are way too many references to choose from, spread across decades, so I think all this must be considered folklore.