Solution 1:

Let $G = \langle X \mid R\rangle$ and $H = \langle Y \mid S\rangle$, and let $\phi\colon H\to\mathrm{Aut}(G)$. Then the semidirect product $G\rtimes_\phi H$ has the following presentation: $$ G\rtimes_\phi H \;=\; \langle X, Y \mid R,\,S,\,yxy^{-1}=\phi(y)(x)\text{ for all }x\in X\text{ and }y\in Y\rangle $$ Note that this specializes to the presentation of the direct product in the case where $\phi$ is trivial.

 

For example, let $G = \langle x \mid x^n = 1\rangle$ be a cyclic group of order $n$, let $H = \langle y \mid y^2=1\rangle$ be a cyclic group of order two, and let $\phi\colon H \to \mathrm{Aut}(G)$ be the homomorphism defined by $\phi(y)(x) = x^{-1}$. Then the semidirect product $G\rtimes_\phi H$ is the dihedral group of order $2n$, with presentation $$ G\rtimes_\phi H \;=\; \langle x,y\mid x^n=1,y^2=1,yxy^{-1}=x^{-1}\rangle. $$