Here are two possibilities:
First you have the obvious 'universal solution':
You start from $C$ any category and $J$ class of maps, you can consider the category $C'$ freely generated from $C$ by adding a retract $r_i$ to each arrow $i \in J$.
$C'$ has the same objects as $C$ and rather complicated arrows, they are described as formal sequence of arrow in $C$ and arrow of the form $r_i$, up to the obvious relation (composing the arrow in $C$ and $r_i \circ i = 1$).
this being said, I belive one can prove that the functor $C \rightarrow C'$ is faithfull if and only if all arrow in $J$ are monomorphisms. which might be interesting (I have an idea of how to prove that, but I haven't tried to write to complete proof of it yet, I would depending on the reaction to that comment).
A second construction, less general, but closer to the 'category of fractions' you mentioned.
Let $C$ be a category with pullback (in fact, we only need pullback of subobjects). Then one can define a category $C'$ of ''partial map'' in $C$ :
An arrow $X \rightarrow Y$ in $C'$ is a sub-object $U \subset X$ together with a map $U \rightarrow Y$ (by subobject, I just mean a monomorphism $U \rightarrow X$, but two such maps are identified if there is an isomorphism $U \rightarrow U'$ wich makes everythings commute, such an isomorphism is unique if it exists).
Those maps are composed as follows: if $X \overset{(U,f)}{\rightarrow} Y \overset{(V,g)}{\rightarrow} Z$ then you pullback $V$ to $U$ along $f$ you get a $W \subset U \subset X$, the pullback of $f$ induce a map $W \rightarrow V$ which you can compose with $g$ to get your map $W \rightarrow Y$.
On easily check that:
this form a category.
the 'total arrow', i.e. those such that $U =X$ form a subcategory isomorphic to $C$.
for each monomorphism $i:X \rightarrow Y$, the partial arrow $r_i: Y \rightarrow X$ which is defined as the identity on $X \subset Y$ and is a retract of $i$.
every arrow in this category if of the form $f \circ r_i$ for $f \in C$ and $r_i$ one of the map above.