The basic idea is simple, and carrying it out requires just a bit of bookkeeping. We will first pass to the case of an inclusion of torsion-free $D$-modules of equal rank $r > 0$ (possibly losing freeness of the larger module). There will then be nothing to do if $r=1$, and if $r > 1$ we use rank-induction to describe these modules compatibly as direct sums of invertible modules in such a way that for the ambient $D$-module all but one of the invertible direct summands is free.
Now for the actual argument. Let $M' \subset D^n$ be the saturation of $M$ (i.e., $D^n \cap (K \otimes_D M)$ inside $K \otimes_D D^n$, where $K = {\rm{Frac}}(R)$), so $D^n/M'$ is torsion-free and hence projective. Thus, $D^n \twoheadrightarrow D^n/M'$ splits, which is to say $D^n = M' \oplus N$ for some $D$-submodule $N$ of $D^n$. Passing to top exterior powers, the invertible $D$-modules $\det M'$ and $\det N$ are inverse to each other. Define $H = \det N$ as a $D$-module; this can be identified with a fractional ideal by choosing a $K$-basis of $K \otimes_D \det N$.
Letting $r = \dim_K (K \otimes_D M)$, so $n-r = \dim_K (K \otimes_D N)$, if $n-r > 0$ then we have $N \simeq D^{n-r-1} \oplus H$ and $M' \simeq D^{r-1} \oplus H^{-1}$. Thus, we can replace $D^n$ with $M'$ to reduce to showing that if $M_1 \subset M_2$ is an inclusion of finitely generated projective $D$-modules with common generic rank $r > 0$ then an isomorphism $M_2 \simeq D^{r-1} \oplus L$ with invertible $L$ (which always exists, necessarily with $L \simeq \det M_2$ as $D$-modules) can be chosen so that the direct sum decomposition is compatible with $M_1$ in the sense that $M_1$ is the direct sum of its intersections with each of those rank-1 direct summands of $M_2$; i.e., it identifies $M_1$ with $J_1 \oplus \dots \oplus J_{r-1} \oplus J_r L$ for nonzero ideals $J_1, \dots, J_r \subset D$.
The case $r=1$ is obvious, so we may assume $r > 1$. Since $D^{r-1}$ occurs as a direct summand of $M_2$, we can find a quotient map $q_2:M_2 \twoheadrightarrow D$. Let $N_2 = \ker q_2$, and $N_1 = M_1 \cap N_2 = \ker q_1$ where $q_1 = q_2|_{M_1}$. Note that $q_1(M_1) \subset D$ is a nonzero integral ideal $I$.
Pick any $m_2 \in M_2$ so that $q_2(m_2) = 1 \in D$, so $I m_2 \subset M_1$. This latter $D$-submodule provides a compatible splitting of $q_1:M_1 \twoheadrightarrow I$. Continuing via induction on $r > 1$, we get compatible decompositions of $M_2$ and $M_1$ as direct sums of invertible $D$-modules in such a way that all but one of the invertible $D$-modules using for $M_2$ is actually free.
QED