The initial statement comes from the fact that if $x \in \Ob(\mathcal{X})$ lies over a scheme $U$ such that $x : U \to \mathcal{X}$ is smooth (resp.\ flat) and if $f$ is smooth (resp.\ flat) then $f(x) : U \to \mathcal{Y}$ is smooth (resp.\ flat), see Morphisms of Stacks, Lemmas \ref{stacks-morphisms-lemma-composition-smooth} and \ref{stacks-morphisms-lemma-composition-flat}. The induced functor $\mathcal{X}_{lisse,\etale} \to \mathcal{Y}_{lisse,\etale}$ (resp.\ $\mathcal{X}_{flat,fppf} \to \mathcal{Y}_{flat,fppf}$) is continuous and cocontinuous by our definition of coverings in these categories. Finally, the commutativity of the diagram is a consequence of the fact that the horizontal morphisms are given by the inclusion functors (see Lemma \ref{lemma-lisse-etale}) and Sites, Lemma \ref{sites-lemma-composition-cocontinuous}. \medskip\noindent To show that $f'_*(g')^{-1} = g^{-1}f_*$ let $\mathcal{F}$ be a sheaf on $\mathcal{X}_\etale$ (resp.\ $\mathcal{X}_{fppf}$). There is a canonical pullback map $$ g^{-1}f_*\mathcal{F} \longrightarrow f'_*(g')^{-1}\mathcal{F} $$ see Sites, Section \ref{sites-section-pullback}. We claim this map is an isomorphism. To prove this pick an object $y$ of $\mathcal{Y}_{lisse,\etale}$ (resp.\ $\mathcal{Y}_{flat,fppf}$). Say $y$ lies over the scheme $V$ such that $y : V \to \mathcal{Y}$ is smooth (resp.\ flat). Since $g^{-1}$ is the restriction we find that $$ \left(g^{-1}f_*\mathcal{F}\right)(y) = \Gamma(V \times_{y, \mathcal{Y}} \mathcal{X},\ \text{pr}^{-1}\mathcal{F}) $$ by Sheaves on Stacks, Equation (\ref{stacks-sheaves-equation-pushforward}). Let $(V \times_{y, \mathcal{Y}} \mathcal{X})' \subset V \times_{y, \mathcal{Y}} \mathcal{X}$ be the full subcategory consisting of objects $z : W \to V \times_{y, \mathcal{Y}} \mathcal{X}$ such that the induced morphism $W \to \mathcal{X}$ is smooth (resp.\ flat). Denote $$ \text{pr}' : (V \times_{y, \mathcal{Y}} \mathcal{X})' \longrightarrow \mathcal{X}_{lisse,\etale} \ (\text{resp. }\mathcal{X}_{flat,fppf}) $$ the restriction of the functor $\text{pr}$ used in the formula above. Exactly the same argument that proves Sheaves on Stacks, Equation (\ref{stacks-sheaves-equation-pushforward}) shows that for any sheaf $\mathcal{H}$ on $\mathcal{X}_{lisse,\etale}$ (resp.\ $\mathcal{X}_{flat,fppf}$) we have \begin{equation} \label{equation-pushforward-lisse-etale} f'_*\mathcal{H}(y) = \Gamma((V \times_{y, \mathcal{Y}} \mathcal{X})', \ (\text{pr}')^{-1}\mathcal{H}) \end{equation} Since $(g')^{-1}$ is restriction we see that $$ \left(f'_*(g')^{-1}\mathcal{F}\right)(y) = \Gamma((V \times_{y, \mathcal{Y}} \mathcal{X})', \ \text{pr}^{-1}\mathcal{F}|_{(V \times_{y, \mathcal{Y}} \mathcal{X})'}) $$ By Sheaves on Stacks, Lemma \ref{stacks-sheaves-lemma-cohomology-on-subcategory} we see that $$ \Gamma((V \times_{y, \mathcal{Y}} \mathcal{X})', \ \text{pr}^{-1}\mathcal{F}|_{(V \times_{y, \mathcal{Y}} \mathcal{X})'}) = \Gamma(V \times_{y, \mathcal{Y}} \mathcal{X},\ \text{pr}^{-1}\mathcal{F}) $$ are equal as desired; although we omit the verification of the assumptions of the lemma we note that the fact that $V \to \mathcal{Y}$ is smooth (resp.\ flat) is used to verify the second condition. \medskip\noindent Finally, the equality $g'_!(f')^{-1} = f^{-1}g_!$ follows formally from the equality $f'_*(g')^{-1} = g^{-1}f_*$ by the adjointness of $f^{-1}$ and $f_*$, the adjointness of $g_!$ and $g^{-1}$, and their ``primed'' versions.