4. D.

Draw $A H \perp B D$ at point $H$.
It is easy to know, $\triangle A M H \backsim \triangle C M D \Rightarrow \frac{A H}{C D}=\frac{A M}{C M}$.
Also, $C D=1$, so,
$A H=\frac{A M}{C M}$.
Let $A M=x$. Then $C M=\sqrt{5}-x$.
In Rt $\triangle A B M$,
$$
A H=\frac{A B \cdot A M}{B M}=\frac{\sqrt{5} x}{\sqrt{5+x^{2}}} .
$$

Therefore, from equation (1) we get
$$
\begin{array}{l}
\frac{\sqrt{5} x}{\sqrt{5+x^{2}}}=\frac{x}{\sqrt{5}-x} \\
\Rightarrow x=\frac{\sqrt{5}}{2} \text { (the other solution } x=2 \sqrt{5} \text { is discarded) } \\
\Rightarrow C M=\frac{\sqrt{5}}{2}, D M=\sqrt{C M^{2}-C D^{2}}=\frac{1}{2} .
\end{array}
$$
4. As shown in Figure 1, in quadrilateral $A B C D$, $\angle B A C$
$$
\begin{array}{l}
=\angle B D C=90^{\circ}, A B \\
=A C=\sqrt{5}, C D=1,
\end{array}
$$

the intersection of the diagonals is $M$.
Then $D M=(\quad)$.
(A) $\frac{\sqrt{3}}{2}$
(B) $\frac{\sqrt{5}}{3}$
(C) $\frac{\sqrt{2}}{2}$
(D) $\frac{1}{2}$