Let $R$ be a commutative ring with unity and $k$ be a field. Let $f: k \to R$ be an "epimorphism" of commutative rings (https://en.wikipedia.org/wiki/Epimorphism) i.e. $f$ is a ring homomorphism preserving unity and for any commutative ring with unity $S$ and ring homomorphisms preserving unity $g,h: R \to S$, $g \circ f=h\circ f$ implies $g=h$. Then is it true that $f$ is an isomorphism ?
I can see that $R$ has a $k$-algebra structure given by $f$ and also since $k$ is a field, $f$ is injective, so enough to prove that $f$ is surjective. But I don't know how to approach further.
The answer to the question "Let $f:k\to R$ be an epimorphism of commutative rings... Then is it true that $f$ is an isomorphism?" is No because the unique morphism $k\to0$ is an epimorphism.
The OP's statement that $f:k\to R$ is necessarily injective is not true.
If the intended question was "is it true that $f$ is surjective?", the answer is Yes, because a faithfully flat epimorphism is an isomorphism by Lemma 10.106.7 in https://stacks.math.columbia.edu/tag/04VM. Indeed any nonzero $k$-vector space is faithfully flat over $k$.