Let $R$ be a commutative ring with $1\not =0$, and let $D\ni 1$ be a multiplicative subset of $R$. Consider the universal characterization of $D^{-1}R$:
There is a morphism $\pi\colon R\to D^{-1}R$ such that for all rings and morphisms $\psi\colon R\to S$ satisfying
- $\psi(1)=1$
- $\psi(D)\subset S^{\times}$
there is a unique morphism $\Psi\colon D^{-1}R\to S$ such that $\Psi\circ\pi=\psi$.
Suppose $D^{-1}R\not=0$. Prove directly from the universal characterization that $\pi(D)\subset (D^{-1}R)^{\times}$.
Note: See p. 707 in Dummit and Foote
The universal "characterisation" you provided is just a property that is only a piece of the true universal property. You can think of it as saying $\phi:R\to D^{-1}R$ is initial; but with respect to what property? Just say that every map $R\to S$ that inverts $D$ factors through $R\to D^{-1}R$ is clearly not enough to characterise $D^{-1}R$.
Consider morphisms $\pi:R\to S$ such that: $\pi(d)$ is invertible for every $d\in D$, if $\pi(x) = 0$ for some $x$ then $dx = 0$ for some $d\in D$, and every element of $S$ is of the form $\pi(r)\pi(d)^{-1}$. Then there exists a ring $D^{-1}R$ together with a morphism $\pi:R\to D^{-1}R$ that is initial with these properties.
In other words, for every $f:R\to S$ with the above properties, there is a unique $g:D^{-1}R\to S$ such that $f = g\circ\pi$. In short, the universal property needs to be stated with the extra properties as above for $\pi$. Factoring every morphism uniquely which inverts $D$ is insufficient to characterise $D^{-1}R$, but I can see how page 707 of Dummit and Foote might have led you to this conclusion. You can find a lucid discussion with proofs in Atiyah and MacDonald's Commutative Algebra pp.37-38.
In this correct setting, your exercise is just part of the definition.