What is the most general category in which exist short exact sequences? Let $A,B,C$ be objects, $0$ the final object, and $f:A\to B$ and $g:B\to C$ morphisms in some category.
Consider the sequence: 
$$
0 \to A \to B \to C \to 0\;.
$$
I would like to say something analogous to:


*

*$f$ is injective (or maybe some kind of kernel is trivial)

*$g$ is surjective (or maybe some kind of cokernel is trivial)

*$fg$ factors through $0$ (or something like $im (f) = ker (g)$).


Of course in the category of modules and in the category of groups all of this makes sense. what about, for example, in Sets? Or in metric spaces?
In general, which properties must my category have to have (a generalization of) exact sequences? 
(For example, I guess we need a terminal object...right?)
 A: Short exact sequences make sense in any category enriched in pointed sets, i.e. in which there is a null arrow $0\colon A\to B$ between any two objects, preserved by composition on both sides ($f\circ 0 = 0$ and $0\circ f=0$ for any composable $f$ and null arrow).  Examples are the category of pointed sets, pointed topological spaces, and categories of algebraic structures with a unique constant.
A kernel of $f\colon A\to B$ is then a universal arrow $k\colon K \to A$ such that $k\circ f = 0$.  A short exact sequence is then a sequence $A\xrightarrow{f} B\xrightarrow{g} C$ such that $f$ is a kernel for $g$ and $g$ a cokernel for $f$.
Marco Grandis has generalised this to a setting where there may be more than one null arrow between two objects.  This allows, for instance, to consider short exact sequences in the category of topological spaces equipped with a distinguished subspace, which are used in algebraic topology.  See On the categorical foundations of homological and homotopical algebra.
Note: you can define another kind of short exact sequences in a general category: a diagram $R\rightrightarrows A\to Q$, where the left-hand side is the kernel pair of the right-hand side and the right-hand side is the coequaliser of the left-hand side.
A: The answer depends on what properties of exact sequences you want satisfied. The book Mal'cev, protomodular, homological, and semi-abelian categories by Francis Borceux and Dominique Bourn answers the question as homological categories -- these are categories that are


*

*pointed, that is, have an object that admits unique morphisms to and from itself

*finitely complete and regular, that is, all morphisms have kernel pairs and coequalizers of those kernel pairs that are stable under pullbacks.

*protomodular, that is, all split epimorphisms have pullbacks so that base change of split epimorphisms is conservative. Equivalently given the first two conditions, that the split short five lemma holds.


In Chapter 3 they give a thorough list of ways to check that a category is protomodular, yielding a list of examples most of which are also homological. Necessary and sufficient conditions for a category of models of an algebraic theory in the category of sets to be homological is that it has a presentation with


*

*Exactly one constant $1$.

*At least one $n+1$-ary operation $(x_1,x_2,\dots,x_n,y)\mapsto\theta(x_1,\dots,x_n,y)$.

*At least $n$ binary operations $(x,y)\mapsto\alpha_i(x,y)$ that serve as partial divisions for the $n+1$-ary operation in the sense that $\alpha_i(x,x)=1$ and $\theta(\alpha_1(x,y),\dots,\alpha_n(x,y),y)=x$.


In particular, if your algebraic theory has a binary operation and one-sided identity and division (but no associativity or commutativity required), then the category of models is homological. It is shown also in the same chapter that the notion of being protomodular behaves well with respect to Yoneda embeddings, so that one can show that categories of sheaves of such models are also homological categories.
In Chapter 4 they show that a homological category has enough structure to


*

*define exact sequences (almost exactly as you do, the requirement is that the image, i.e. cokernel of kernel of $f$ is the kernel of $g$)

*prove the five lemma

*prove the nine lemma

*prove the snake lemma

*construct the long exact sequence of homology from a short exact sequence of chain complexes of the category


In Chapter 5, they define a semi-abelian category as an exact homological category, but don't really have more to say on exact sequences and homology theory. Instead, in the proceedings Categories in Algebra, Geometry, and Mathematical Physics, Dominique Bourn has a paper Moore normalization and Dold-Kan theorem for semi-abelian categories. In it he shows that for a semi-abelian category, simplicial objects are chain complexes with additional structure in the sense that the category if simplicial objects is monadic over the category of chain complexes.
Consequently, semi-abelian categories provide a setting in which one can try to understand non-abelian cohomology. In this sense, semi-abelian categories are probably the best context in which a notion of exact sequence can be developed, since the whole point of exact sequences is their (co)homology theory. Unfortunately, I don't know where the story goes from here.
