Expanding the comments to an answer.
As Rene pointed out this fact is a special case of a general result. Assume that $N\subseteq M$ are free abelian groups of the same rank $n$. Let $\mathcal{B}=\{x_1,x_2,\ldots,x_n\}$ be a basis of $M$,
and $\mathcal{C}=\{y_1,y_2,\ldots,y_n\}$ be a basis of $N$. As $N\subset M$ we have that
$$
y_i=\sum_{j=1}^na_{ij}x_j
$$
for some integer matrix $A=(a_{ij})$. Everything follows from finding the Smith normal form of $A$. What that says is that there exists integer matrices $P$ and $Q$ such that
their determinants are $\pm1$ and
$$
PAQ=\left(\begin{array}{ccccc}d_1&0&0&\cdots&0\\
0&d_2&0&\cdots&0\\
0&0&d_3&\cdots&0\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
0&\cdots&0&0&d_n
\end{array}\right)
$$
for some positive integers $d_i, i=1,2,\ldots,n$.
Furthermore, here $d_{i+1}\mid d_i$ for all $i$.
What this means is that if we replace $\mathcal{B}$ with $\mathcal{B}'=Q^{-1}\mathcal{B}$,
and $\mathcal{C}$ with $\mathcal{C}'=P\mathcal{C}$, the resulting bases
$\mathcal{B}'=\{x_1',x_2,\ldots,x_n'\}$ and $\mathcal{C}'=\{y_1',y_2',\ldots,y_n'\}$ are stacked, IOW $y_i'=d_ix_i'$ for all $i$.
This implies immediately that
$$
M/N\cong \Bbb{Z}_{d_1}\oplus\Bbb{Z}_{d_2}\oplus\cdots\oplus\Bbb{Z}_{d_n}.
$$
Note that as $\det P=\pm1$ and $\det Q=\pm1$, it follows that
$$
|\det(A)|=d_1d_2\cdots d_n.
$$
Your claim follows from this.