Here is an attempt to prove Angelo's comment (it seems too simple to use a reference for it):

$X,Y$ defined over $S$. If they are both proper over $S$, then so is $f$ by Hartshorne, II.4.8(e). In particular $f$ is separated and universally closed.

If $X$ is projective over $S$ then for some $n$ there exists $\iota: X\to \mathbb P^n_{S}$, a universally closed separated immersion.

The morphism $\nu:X\to\mathbb P^n_S\times_S Y=:\mathbb P^n_Y$ defined by $x \mapsto (x,f(x))\in \mathbb P^n_S\times_SY$ is the composition of the base extension of $f$ by the projection $\pi:\mathbb P^n_Y\to Y$; $f_{\pi}$, the embedding $\iota$ base extended by the identity of $X$; $X\times_SX\to \mathbb P^n_S\times_S X$ and the diagonal morphism of $X$; $\Delta_X: X\to X\times_S X$. I.e., $\nu=f_{\pi}\circ (\iota\times_S{\rm id}_X)\circ \Delta_X: X\to \mathbb P^n_S\times_S Y$. Actually, this might be a better definition than the one with "coordinates". Since $f$ is separated and universally closed and $\iota$ is universally closed, it follows that $\nu$ is closed. It is obviously an embedding. Now $f=\pi\circ\nu$ and hence it is projective.

Well, may be it was not that simple, and Angelo might tell me that it is wrong....