These questions are trivial for the category of affine schemes (since equivalences of categories preserve monomorphisms and epimorphisms), so I assume your question refers to the category of all schemes.
Since $\mathrm{Spec} : \mathbf{CRing}^{\mathrm{op}} \to \mathbf{Sch}$ is right adjoint to the global sections functor (see for example here), it preserves all limits (see here), and hence it preserves all monomorphisms (see here). This means that an epimorphism of commutative rings is mapped to a monomorphism of the associated schemes. Notice that epimorphisms of commutative rings are much more general than surjective homomorphisms, for example every localization is an epi. See MO/109.
The Spec functor does not preserve epimorphisms, though. In other words, if $A \to B$ is an injective homomorphism of commutative rings, there might be schemes $X$ with two different morphisms $\mathrm{Spec}(A) \to X$ which agree when composed with $\mathrm{Spec}(B) \to \mathrm{Spec}(A)$. (So, the map $X(A) \to X(B)$ is not injective.) Namely, when $\mathrm{Spec}(B) \to \mathrm{Spec}(A)$ happens to be an open immersion which is not an isomorphism, we can construct $X$ as the pushout (glueing) of that open immersion with itself. A concrete example therefore is $A =k[x]$, $B=k[x,x^{-1}]$. The scheme $X$ also known as the "affine line with doubled origin".
Notice that the scheme constructed above is not separated. In fact, we can prove that if $X$ is a separated scheme, the induced map $X(A) \to X(B)$ is injective (hint: consider the equalizer of two $A$-points and use that it is closed). This is related to the valuative criterion for separated morphisms, which proves that the converse is also true, at least when we assume that $X$ is quasi-separated. Therefore, $\mathrm{Spec}$ does preserve epimorphisms when corestricted to the category of separated schemes.
Related questions: