When does the global sections of a prescheme X over an other S equals those of S?n Let $f=(\varphi,\theta):X\longrightarrow S$ a morphism of preschemes whith $\varphi$ surjective. Let $\theta(S):\Gamma(S,O_S)\longrightarrow \Gamma(S,f_* O_X)=\Gamma(\varphi^{-1}(S),O_X)=\Gamma(X,O_X)$.
What conditions can we put on $f$ in order to get that the morphism $\theta(S)$ is
(1) injective
(2) surjective if it is already injective (and so bijective)?
 A: Obligatory tautological answer: since $f$ includes the data of $\theta$, it's necessary and sufficient to require that $\theta(S)$ is injective (resp. surjective).
Since you're trying to extract information about $\theta(S)$, my guess is that you actually want conditions on $\varphi$, $S$, and/or $X$, which don't specifically refer to $\theta$.
Injectivity
Suppose $I$ is the kernel of $\theta(S)$. Then the morphism $X\to Spec(O_S(S))$ factors through the closed subscheme $Spec(O_S(S)/I)$. Since $X\to S$ is surjective, this closed subscheme must contain the image of $S$ (set theoretically). The closure of the image of $S$ in $Spec(O_S(S))$ is all of $Spec(O_S(S))$,† so $Spec(O_S(S)/I)$ must be set-theoretically equal to $Spec(O_S(S))$, so $I$ is contained in every prime of $O_S(S)$, so it is in the nilradical.

In particular, if $S$ is reduced, $\theta(S)$ is injective.

Note that we didn't actually need $\varphi$ surjective, just that the closure of the image is all of $S$. Since composing $X\to S$ with a nilpotent thickening of $S$ doesn't change $X$ or $\phi$ at all, I imagine you can't get a better condition than this without saying something directly about $\theta$.
† If $S$ is quasi-compact and 
its image in $Spec(O_S(S))$ is contained in the complement of some basic open neighborhood $D(f)$, then $f\in O_S(S)$ vanishes at every point of $S$, so $f$ is nilpotent on any affine open subscheme of $S$. Since $S$ is quasi-compact, there is a single $n$ such that $f^n$ is identically zero on $S$. Since $f$ is nilpotent, $D(f)=D(f^n)\subseteq Spec(O_S(S))$ is empty. So the image of $S$ is not in the complement of any non-empty open subset of $Spec(O_S(S))$.
There must be a way to show this without assuming quasi-compactness of $S$, but I don't see it right now. Suppose $S\to Spec(O_S(S))$ set theoretically factors through a closed subset $Z$. Why must there be a closed subscheme structure on $Z$ so that $S$ factors scheme theoretically through $Z$? A scheme theoretic factorization of $S$ through $Spec(O_S(S)/I)$ amounts to a factorization of the identity map $O_S(S)\to O_S(S)$ through the quotient $O_S(S)\to O_S(S)/I$, which cannot happen unless $I=0$.
Surjectivity
I can't think of a good condition to ensure surjectivity that isn't essentially tautological.
There's no condition you can put on $\varphi$ or the underlying topological space of $X$. If $S=Spec(k)$ with $k$ a field, you could take $X$ to be a projective or affine curve over $S$. These two curves are homeomorphic, yet you have a surjection in one case but not the other.
A necessary but insufficient condition for isomorphism is that $S$ have as many connected components as $X$, since connected components correspond to irreducible idempotents in the ring of regular functions.
Note that if $X$ and $S$ are arbitrary projective schemes over a field, then any morphism between them induces an isomorphism on global regular functions. Any Stein morphism $f\colon X\to S$ obviously makes $\theta(S)$ an isomorphism. Is there an example of a surjective non-Stein $f$ which makes $\theta(S)$ an isomorphism?
