This already fails in the affine case. For example, if $Y = \mathbf A^1$ and $X = \mathbf A^1 \setminus \{0\}$, then $Y$ is the scheme-theoretic image of $X \hookrightarrow Y$. But if $Z$ is the line with two origins, then the two inclusions $Y \to Z$ agree on $X$ but are not identical.
There is a positive result when $f$ has closed image, for then $X \to \operatorname{im}(f)$ is surjective (see also the introduction to this question). For schemes of finite type over a Jacobson ring (e.g. $\mathbf Z$ or a field $k$), this is the only way $X \to \operatorname{im}(f)$ can be an epimorphism:
Lemma. Let $f \colon X \to Y$ be an epimorphism of schemes, and let $y \in Y$ be a closed point. Then there exists $x \in X$ with $f(x) = y$. In particular, if $Y$ is Jacobson and $f$ of finite type, then $f$ is surjective.
Proof. For the first statement, consider the open $U = Y\setminus\{y\}$ and let $Z$ be two copies of $Y$ glued along $U$. The two natural inclusions $Y \to Z$ differ, so their restrictions to $X$ differ, showing that $y$ is in the (set-theoretic) image of $f$. The second statement follows from Chevalley's theorem. $\square$
However, there exist epimorphisms between non-Jacobson schemes that are not surjective:
Example. Let $A$ be a local domain of dimension $\geq 2$; for example $A = k[x,y]_{(x,y)}$. Let $A \subseteq B$ be a local homomorphism to a discrete valuation ring $B$; for example by blowing up the closed point of $A$ and localising at a generic point of the exceptional fibre. Let $X = \operatorname{Spec} B$ and $Y = \operatorname{Spec} A$. Then $f \colon X \to Y$ is not surjective (it only hits the generic point $\eta$ and the closed point $s$), but it is an epimorphism. Indeed, if $g,h \colon Y \rightrightarrows Z$ agree on $X$, then $g(s) = h(s)$. If $U \subseteq Z$ is an affine open neighbourhood of $g(s)$, then $g$ and $h$ both land in $U$, since the only open subset of $Y$ containing $s$ is $Y$ itself. The result then follows since $A \subseteq B$ is a monomorphism of rings. $\square$