[proofplan]
We prove that the formula $h(\tfrac{r}{s}) = f(s)^{-1}f(r)$ defines a well-defined ring homomorphism $S^{-1}R \to B$ satisfying $h \circ \iota = f$, and that it is the unique such map. The uniqueness argument is purely algebraic: the multiplicative property of $h$ forces $h(\tfrac{1}{s}) = f(s)^{-1}$, which together with $h \circ \iota = f$ determines $h$ on all fractions. For the second part, we apply the universal property in both directions to construct mutually inverse maps, yielding the isomorphism.
[/proofplan]
[step:Force the formula for $h$ from uniqueness]
Suppose $h \colon S^{-1}R \to B$ is a ring homomorphism satisfying $h \circ \iota = f$. For any $s \in S$, we have $\tfrac{s}{1} \cdot \tfrac{1}{s} = \tfrac{s}{s} = \tfrac{1}{1}$ in $S^{-1}R$, so
\begin{align*}
h\!\left(\frac{s}{1}\right) \cdot h\!\left(\frac{1}{s}\right) = h\!\left(\frac{1}{1}\right) = 1_B.
\end{align*}
Since $h(\tfrac{s}{1}) = h(\iota(s)) = f(s)$, this gives $f(s) \cdot h(\tfrac{1}{s}) = 1_B$, so $h(\tfrac{1}{s}) = f(s)^{-1}$ (the inverse exists because $f(s)$ is a unit by hypothesis). Every fraction can be written as $\tfrac{r}{s} = \tfrac{r}{1} \cdot \tfrac{1}{s}$, so
\begin{align*}
h\!\left(\frac{r}{s}\right) = h\!\left(\frac{r}{1}\right) \cdot h\!\left(\frac{1}{s}\right) = f(r) \cdot f(s)^{-1}.
\end{align*}
Since $B$ need not be commutative, we must verify this equals $f(s)^{-1}f(r)$. In fact, using $\tfrac{r}{s} = \tfrac{1}{s} \cdot \tfrac{r}{1}$ (which holds in $S^{-1}R$ since $R$ is commutative), we also get $h(\tfrac{r}{s}) = f(s)^{-1}f(r)$. Either expression determines $h$ uniquely.
[guided]
The key question is: does the requirement $h \circ \iota = f$ together with $h$ being a ring homomorphism leave any freedom in the choice of $h$? The answer is no.
Suppose $h \colon S^{-1}R \to B$ is a ring homomorphism satisfying $h \circ \iota = f$. For any $s \in S$, we have $\tfrac{s}{1} \cdot \tfrac{1}{s} = \tfrac{1}{1}$ in $S^{-1}R$. Since $h$ is a ring homomorphism preserving $1$, applying $h$ gives
\begin{align*}
h\!\left(\frac{s}{1}\right) \cdot h\!\left(\frac{1}{s}\right) = h\!\left(\frac{1}{1}\right) = 1_B.
\end{align*}
Now $h(\tfrac{s}{1}) = h(\iota(s)) = f(s)$, so $f(s) \cdot h(\tfrac{1}{s}) = 1_B$. Since $f(s)$ is a unit of $B$ by hypothesis, this forces $h(\tfrac{1}{s}) = f(s)^{-1}$. There is no choice here.
Every fraction decomposes as $\tfrac{r}{s} = \tfrac{r}{1} \cdot \tfrac{1}{s}$, so the multiplicativity of $h$ gives
\begin{align*}
h\!\left(\frac{r}{s}\right) = h\!\left(\frac{r}{1}\right) \cdot h\!\left(\frac{1}{s}\right) = f(r) \cdot f(s)^{-1}.
\end{align*}
Since $R$ is commutative, the equality $\tfrac{r}{s} = \tfrac{1}{s} \cdot \tfrac{r}{1}$ also holds in $S^{-1}R$, giving the equivalent expression $h(\tfrac{r}{s}) = f(s)^{-1}f(r)$. Thus the formula for $h$ is forced, establishing uniqueness.
[/guided]
[/step]
[step:Verify that the formula $h(\tfrac{r}{s}) = f(s)^{-1}f(r)$ is well-defined]
Suppose $\tfrac{r_1}{s_1} = \tfrac{r_2}{s_2}$ in $S^{-1}R$. By definition of the equivalence relation, there exists $t \in S$ with
\begin{align*}
t(s_2 r_1 - s_1 r_2) = 0 \quad \text{in } R.
\end{align*}
Applying $f$ and using that $f$ is a ring homomorphism:
\begin{align*}
f(t)(f(s_2)f(r_1) - f(s_1)f(r_2)) = 0 \quad \text{in } B.
\end{align*}
Since $t \in S$, the element $f(t)$ is a unit of $B$. Left-multiplying by $f(t)^{-1}$ gives $f(s_2)f(r_1) = f(s_1)f(r_2)$. Left-multiplying by $f(s_1)^{-1}$ and right-multiplying by $f(s_2)^{-1}$ (both are units since $s_1, s_2 \in S$):
\begin{align*}
f(s_1)^{-1}f(r_1) = f(s_2)^{-1}f(r_2).
\end{align*}
Therefore $h(\tfrac{r_1}{s_1}) = h(\tfrac{r_2}{s_2})$, and $h$ is well-defined.
[/step]
[step:Verify that $h$ is a ring homomorphism satisfying $h \circ \iota = f$]
We check the ring homomorphism axioms. For addition: let $\tfrac{r_1}{s_1}, \tfrac{r_2}{s_2} \in S^{-1}R$. Then
\begin{align*}
h\!\left(\frac{r_1}{s_1} + \frac{r_2}{s_2}\right) &= h\!\left(\frac{s_2 r_1 + s_1 r_2}{s_1 s_2}\right) = f(s_1 s_2)^{-1} f(s_2 r_1 + s_1 r_2) \\
&= f(s_2)^{-1} f(s_1)^{-1}(f(s_2)f(r_1) + f(s_1)f(r_2)) \\
&= f(s_1)^{-1}f(r_1) + f(s_2)^{-1}f(r_2) = h\!\left(\frac{r_1}{s_1}\right) + h\!\left(\frac{r_2}{s_2}\right).
\end{align*}
For multiplication:
\begin{align*}
h\!\left(\frac{r_1}{s_1} \cdot \frac{r_2}{s_2}\right) = h\!\left(\frac{r_1 r_2}{s_1 s_2}\right) = f(s_1 s_2)^{-1} f(r_1 r_2) = f(s_2)^{-1} f(s_1)^{-1} f(r_1) f(r_2).
\end{align*}
Since $R$ is commutative, $f(s_1)^{-1}f(r_1) \cdot f(s_2)^{-1}f(r_2)$ requires rearrangement. We use $f(s_1)^{-1}f(r_1) = f(r_1)f(s_1)^{-1}$ (which follows from $r_1 s_1 = s_1 r_1$ in $R$, giving $f(r_1)f(s_1) = f(s_1)f(r_1)$, and conjugating by $f(s_1)^{-1}$). Then:
\begin{align*}
h\!\left(\frac{r_1}{s_1}\right) \cdot h\!\left(\frac{r_2}{s_2}\right) = f(s_1)^{-1}f(r_1) \cdot f(s_2)^{-1}f(r_2) = f(s_2)^{-1}f(s_1)^{-1}f(r_1)f(r_2),
\end{align*}
where the last equality uses that $f(r_1)$ commutes with $f(s_2)^{-1}$ (since $f(r_1)$ and $f(s_2)$ commute, being images of commuting elements). This equals $h(\tfrac{r_1 r_2}{s_1 s_2})$.
Finally, $h(\tfrac{1}{1}) = f(1)^{-1}f(1) = 1_B$, and for any $r \in R$:
\begin{align*}
h(\iota(r)) = h\!\left(\frac{r}{1}\right) = f(1)^{-1}f(r) = f(r).
\end{align*}
So $h \circ \iota = f$.
[/step]
[step:Construct the isomorphism $\varphi \colon S^{-1}R \xrightarrow{\sim} A$ from two applications of the universal property]
Suppose $(A, j)$ is another pair satisfying the same universal property. We apply the universal property of $(S^{-1}R, \iota)$ to the map $j \colon R \to A$: since $j(u)$ is a unit in $A$ for all $u \in U$, there exists a unique ring homomorphism
\begin{align*}
\varphi \colon S^{-1}R \to A \quad \text{with} \quad j = \varphi \circ \iota.
\end{align*}
Symmetrically, we apply the universal property of $(A, j)$ to the map $\iota \colon R \to S^{-1}R$: since $\iota(u) = \tfrac{u}{1}$ is a unit in $S^{-1}R$ for all $u \in U$, there exists a unique ring homomorphism
\begin{align*}
\psi \colon A \to S^{-1}R \quad \text{with} \quad \iota = \psi \circ j.
\end{align*}
Consider the composition $\psi \circ \varphi \colon S^{-1}R \to S^{-1}R$. We have $(\psi \circ \varphi) \circ \iota = \psi \circ j = \iota$. The identity $\operatorname{id}_{S^{-1}R}$ also satisfies $\operatorname{id}_{S^{-1}R} \circ \iota = \iota$. By the uniqueness clause in the universal property of $(S^{-1}R, \iota)$ applied to the map $\iota$, we conclude $\psi \circ \varphi = \operatorname{id}_{S^{-1}R}$.
By the same argument with the roles reversed, $(\varphi \circ \psi) \circ j = \varphi \circ \iota = j$, and by uniqueness in the universal property of $(A, j)$ applied to $j$, we get $\varphi \circ \psi = \operatorname{id}_A$.
Therefore $\varphi$ and $\psi$ are mutually inverse ring isomorphisms. The explicit formula is $\varphi(\tfrac{r}{s}) = j(s)^{-1}j(r)$, as shown in the first step applied to $f = j$.
[guided]
The second part of the theorem says that the pair $(S^{-1}R, \iota)$ is unique up to unique isomorphism. This is a standard consequence of universal properties: any two objects satisfying the same universal property are canonically isomorphic. The mechanism is to use each universal property to build a map in one direction, then show the compositions are identities by uniqueness.
We apply the universal property of $(S^{-1}R, \iota)$ to the homomorphism $j \colon R \to A$. Since $j(u)$ is a unit in $A$ for every $u \in U$ (by hypothesis on $(A, j)$), the universal property provides a unique ring homomorphism $\varphi \colon S^{-1}R \to A$ with $j = \varphi \circ \iota$, given by $\varphi(\tfrac{r}{s}) = j(s)^{-1}j(r)$.
Symmetrically, we apply the universal property of $(A, j)$ to the homomorphism $\iota \colon R \to S^{-1}R$. Since $\iota(u) = \tfrac{u}{1}$ is a unit in $S^{-1}R$ (its inverse is $\tfrac{1}{u}$), the universal property of $(A, j)$ provides a unique ring homomorphism $\psi \colon A \to S^{-1}R$ with $\iota = \psi \circ j$.
Now consider $\psi \circ \varphi \colon S^{-1}R \to S^{-1}R$. This satisfies $(\psi \circ \varphi) \circ \iota = \psi \circ (\varphi \circ \iota) = \psi \circ j = \iota$. But $\operatorname{id}_{S^{-1}R}$ also satisfies $\operatorname{id}_{S^{-1}R} \circ \iota = \iota$. The universal property of $(S^{-1}R, \iota)$ applied to the map $f = \iota$ says there is a **unique** ring homomorphism $S^{-1}R \to S^{-1}R$ factoring $\iota$ through $\iota$. Since both $\psi \circ \varphi$ and $\operatorname{id}_{S^{-1}R}$ qualify, they must be equal: $\psi \circ \varphi = \operatorname{id}_{S^{-1}R}$.
By exactly the same argument with the roles exchanged (applying the universal property of $(A, j)$ to $f = j$), we obtain $\varphi \circ \psi = \operatorname{id}_A$. Therefore $\varphi$ is a ring isomorphism with inverse $\psi$.
[/guided]
[/step]