When does Sheafification commute with direct image?
The question reduces to a question about sheaves of sets, so I will just work with those (instead of modules or whatever).
The point is that we have the following commutative diagram of right adjoint functors, $$\require{AMScd} \begin{CD} \mathbf{Sh}(X) @>>> \mathbf{Sh}(Y) \\ @VVV @VVV \\ \mathbf{Psh}(X) @>>> \mathbf{Psh}(Y) \end{CD}$$ and you are asking what happens when you take the left adjoints of only the vertical arrows. Well, in that case, we get a canonical natural transformation as below, $$\begin{CD} \mathbf{Sh}(X) @>>> \mathbf{Sh}(Y) \\ @AAA \Uparrow @AAA \\ \mathbf{Psh}(X) @>>> \mathbf{Psh}(Y) \end{CD}$$ whose component at a presheaf $\mathscr{F}$ on $X$ is the morphism $a f_* \mathscr{F} \to f_* a \mathscr{F}$ induced by the universal property of $a f_* \mathscr{F}$ applied to the direct image of the universal morphism $\mathscr{F} \to a \mathscr{F}$. In particular, $a f_* \mathscr{F} \to f_* a \mathscr{F}$ is automatically an isomorphism if $\mathscr{F}$ is a sheaf on $X$, as you would expect.
Now, consider a sieve $R$ in $X$, i.e. a collection of open subspaces of $X$ that is downward-closed, i.e. if $U' \subseteq U$ and $U \in R$ then $U' \in \mathfrak{U}$ as well. Let $\hat{U} = \bigcup_{U \in R} U$. We can think of $R$ as a presheaf on $X$: $R (U) = 1$ if $U \in R$ and $R (U) = \emptyset$ otherwise. The sheafification of $R$ is easy to compute: it is the sheaf $a R$ such that $(a R) (U) = 1$ if $U \subseteq \hat{U}$ and $(a R) (U) = \emptyset$ otherwise. The direct image $f_* R$ is also a sieve, namely the collection of all open subspaces $V \subseteq Y$ such that $f^{-1} V \in R$. Let $\hat{V} = \bigcup_{V \in f_* R} V$.
Notice that $f^{-1} \hat{V} = \bigcup_{V \in f_* R} f^{-1} V \subseteq \bigcup_{U \in R} U = \hat{U}$, so $a f_* R \to f_* a R$ is an isomorphism if and only if the following condition is satisfied:
- For every open subspace $V \subseteq Y$, $f^{-1} V \subseteq \hat{U}$ if and only if $V \subseteq \hat{V}$.
The above condition being satisfied for all sieves $R$ in $X$ is something like the topology of $X$ being induced by the topology of $Y$, but it is not really the same. Certainly, if $f : X \to Y$ is the inclusion of a subspace (not necessarily open or closed), then $a f_* R \to f_* a R$ is an isomorphism for all sieves $R$. This also happens if $X$ is the spectrum of a discrete valuation ring and $Y$ is the point – even though the topology of $X$ is not induced by the topology of $Y$ in this case. And, for example, if $f : X \to Y$ is the codiagonal/fold map $Y \amalg Y \to Y$, then one can easily find a sieve $R$ such that $a f_* R \to f_* a R$ is not an isomorphism.
We still haven't really addressed the general case of a presheaf instead of a sieve. Things are more complicated here, but what is still true is that if $f : X \to Y$ is the inclusion of an open subspace then $a f_* \mathscr{F} \to f_* a \mathscr{F}$ is always an isomorphism – this is more or less obvious. On the other hand, bad things can happen if $f : X \to Y$ is the inclusion of a non-open subspace: for example, if $f : X \to Y$ is the inclusion of a point and $\mathscr{F}$ is a constant presheaf on $X$, then $a f_* \mathscr{F}$ is the sheafification of a constant presheaf on $Y$ while $f_* a \mathscr{F}$ is a skyscraper sheaf.