Let $C$ be category with finite products and $G$ be a group object in the category $C$. Now let $X$ be object in $C$. Now, consider the product $G \times X$.
Is true that $\pi_2:G \times X \rightarrow X$ is a group object in the slice category $C/X$? ($pi_2$ is the projection map)
I think it's true because if $U \rightarrow X$ is an object in $C/X$, then $Hom_X(G \times X, U)$ is isomoporhic to $G(U)$?
First, $\mathcal C/X$ hase a terminal object, namely $id_X$, though I'll use $\pi_2^1: 1\times X\to X$ for consistency. For $\mathcal C/X$ to have products in general requires $\mathcal C$ to have pullbacks, but since we only need the product of $\pi_2^G : G\times X\to X$ with itself, we can easily demonstrate that $\pi_2^{G\times G}:(G\times G)\times X\to X$ is that pullback (up to isomorphism).
If $e:1\to G$, $m:G\times G\to G$, and $i:G\to G$ are the arrows making up the group structure on $G$ in $\mathcal C$, then $e\times X:\pi_2^1\to\pi_2^G$, $m\times X$, and $i\times X$ form a group structure on $\pi_2^G$ in $\mathcal C/X$. Generally, $\pi_2^B\circ (f\times id)=\pi_2^A$ for $f:A\to B$ so they are all arrows of $\mathcal C/X$. And then all the group laws lift by functoriality of $-\times X$, e.g. $$(m\times X)\circ(\langle e,id_G\rangle\times X) = (m\circ\langle e,id_G\rangle)\times X = id_G\times X = id_{G\times X}$$
Conceptually, you can think of an object of $\mathcal C/X$, e.g. $p:A\to X$, as a "family" of types "indexed" by $X$. I like using logical notation for this: $x:X\vdash A(x)$. Arrows of $\mathcal C/X$ are then "index-wise" arrows. In the logical perspective they are terms-in-context like: $x:X;a:A(x)\vdash f(x,a):B(x)$ for an arrow $f:p\substack{A\\\downarrow\\X}\to\substack{B\\\downarrow\\X}q$. In this perspective, $\pi_2^A:A\times X \to X$ corresponds to a "family" consisting of the same type, $A$, for each "element" of $X$, i.e. $x:X\vdash A$. That is, a constant family. We can identify $\mathcal C$ with $\mathcal C/1$ and which can be thought of as types and terms in the empty context, $\cdot\vdash A$. Basically, we had $\cdot;g:G\vdash i(g):G$ etc. and we just "weakened" this by viewing these as types and terms in the context $X$ that just don't depend on $X$.
In this particular case, weakening can be viewed as pulling back along the arrow $!_X : X\to 1$ which induces a pullback functor $!_X^* :\mathcal C\simeq \mathcal C/1\to\mathcal C/X$ which is indeed isomorphic to the functor mapping $A\mapsto\pi_2^A$. This functor has a left adjoint, post-composition by $!_X$ or equivalently the domain projection. Being a right adjoint $!_X^*$ preserves finite products (among all other limits) and, of course, as a functor, it preserves commutative diagrams. Thus it automatically turns any model of any essentially algebraic theory in $\mathcal C$ into a model in $\mathcal C/X$.