Concrete Categories Where Epis are Just Surjections
Another category where all epimorphisms are surjective is the category of all topological spaces. Indeed, let $X$ and $Y$ be topological spaces, and let $f\colon X\to Y$ be an epimorphism. Let $Z=\{0,1\}$ endowed with the indiscrete topology, and let $g\colon Y\to Z$ be the characteristic function of $f(X)$. If $h\colon Y\to Z$ is the constant function $1$, then $gf = hf$, hence $g=h$, so $f(X)=Y$. On the other hand, in the category of Hausdorff topological spaces, $f\colon X\to Y$ is an epimorphism if and only if $f(X)$ is dense in $Y$.
As far as I know, there is no simple characterization even in the case of concrete categories, even in the case of categories of algebras. Isbell's dominions are a common tool to study the question (see this answer for the references which by the way also contains the characterization of dominions in the category of semigroups). Also this one, which includes the statement of the corresponding theorem for rings; and this one.
Getting into some of the stuff I find interesting, which is restricted to varieties of groups (a variety of groups is a full subcategory of groups that is closed under subgroups, homomorphic images, and arbitrary direct products; equivalently, the category of all groups that satisfies a set of identities):
It's not even known which varieties of groups have the property that all epimorphisms are surjective. For example, the inclusion $A_n\hookrightarrow A_{n+1}$ is an epimorphism in the variety generated by $A_{n+1}$ if $n\geq 4$. More generally, for all except a couple of finite nonabelian simple groups $S$, if $\mathfrak{V}$ is the variety generated by $S$, then there is a proper subgroup $H$ of $S$ such that $H\hookrightarrow S$ is an epimorphism. See Dominions in varieties generated by simple groups, Algebra Universalis 48 (2002), 133-143, MR 2003h:20051. (The paper does not prove the statement about "all except a couple", but it gives a characerization of which subgroups would be epimorphically embedded, and except for a few "small" simple groups of Lie type with $p=2$, they all have such subgroups.)
Peter Neumann proved that any full subcategory of Group which is closed under quotients and in which every group is solvable has the property that all epimorphisms are surjective. (Splitting groups and projectives in varieties of groups, Quart. J. Math. Oxford (2) 18 (1967), pp 325-332). This was generalized somewhat by Susan McKay (Surjective epimorphisms in classes of groups, Quart. J. Math. Oxford (2) 20 (1969), pp. 87-90), to any quotient-closed class of groups that lies between a variety of the form $\mathfrak{A}\mathfrak{V}$ and one of the form $\mathfrak{S}\mathfrak{V}$, where $\mathfrak{A}$ is a nontrivial variety of abelian groups, and $\mathfrak{S}$ is a variety of solvable groups.
In Nonsurjective epimorphisms in decomposable varieties, Algebra Universalis 48, 145–150 (2002). MR 1929901(2003h:20052), it is shown that:
Theorem. Let $\mathfrak{V}=\mathfrak{NQ}$ be a nontrivial decomposition of the variety of groups $\mathfrak{V}$. For $G\in\mathfrak{V}$ and $H$ a subgroup of $G$, the following are equivalent:
- $H\hookrightarrow G$ is an epimorphism in $\mathfrak{V}$;
- $H\mathfrak{Q}(G) = G$ and $H\cap\mathfrak{Q}(G)\hookrightarrow \mathfrak{Q}(G)$ is an epimorphism in $\mathfrak{N}$;
- For every normal subgroup $N\triangleleft G$ such that $N\in\mathfrak{N}$ and $G/N\in\mathfrak{Q}$, $HN=G$ and $H\cap N\hookrightarrow N$ is an epimorphism in $\mathfrak{N}$.
(Above, $\mathfrak{Q}(G)$ is the $\mathfrak{Q}$-verbal subgroup of $G$).
In particular, a decomposable variety of groups has nonsurjective epimorphisms only if the first indecomposable factor has nonsurjective epimorphisms. I've conjectured that the condition is also necessary.