Here are three possibilities:
First: you have the obvious 'universal solution':
You start from $C$ any category and $J$ a set 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 will give a proof below in the case where $C$ is small, but it should be true in general either, eventually using a large cardinal axiom, or by just refining the construction a little).
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:
1) this form a category.
2) the 'total arrow', i.e. those such that $U =X$ form a subcategory isomorphic to $C$.
3) 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$.
4) 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.
The thrid construction, only applies to a small category $C$ but with no other assumptions. You look at the category $\widehat{C}$ of presheaves on $C$. Monomorphism in $C$ stay monomorphisms in $\widehat{C}$, so one can look at the category whose objects are objects of $C$ and whose arrow are partial maps in $\widehat{C}$. As $\widehat{C}$ has pullbacks this also gives a solution to your problem.
This allows to proves the claim made in the first construction, at least for small category: for any small category $C$ and $J$ a set of monomorphisms in $C$, there exists a faithfull functor to a category $C'$ such that all arrow in $J$ have retraction in $C'$, hence the category obtained by universally adding the retraction is indeed a faithful extention of $C$.
Final remark:
None of the construction above, will produce a locally small category in full generality:
- In the first if you start form a proper class of arrow $J$ you will almost certainly end up with a non locally small category.
- In the second construction, the category of partial arrow will be locally small if and only if you started with a well-powered category.
- For the third one, you need a small category, although it might works for certain non-small category. Also you can adapt the idea and use another an embeddings into a finitely complete category. For example any accessible category can be embedded in $prsh(C)$ of $C$ small.