This is true if $D$ is not a perfect square. This can be proved via the fundamental homomorphism theorem. Define a map
$$\phi:\mathbb{Q}[x]\to\mathbb{Q}(\sqrt{D})$$
by $\phi(f)=f(\sqrt{D})$. It is straightforward to check that $\phi$ is a surjective homomorphism. Therefore, $\mathbb{Q}[x]/\ker\phi\cong\mathbb{Q}(\sqrt{D})$. It is left to check that $\ker\phi=(x^2-D)$. Indeed, certainly $(x^2-D)\subset\ker\phi$. On the other hand, as $x^2-D$ is irreducible over $\mathbb{Q}$ it follows that $(x^2-D)$ is maximal. As $\ker\phi\neq\mathbb{Q}[x]$, we must have $\ker\phi=(x^2-D)$.
Now, as pointed out in the comments, if $D=d^2$, then $\mathbb{Q}(\sqrt{D})=\mathbb{Q}$. However, using the Chinese Remainder Theorem, we have
$$\mathbb{Q}[x]/(x^2-D)\cong\mathbb{Q}[x]/(x-d)\oplus\mathbb{Q}[x]/(x+d)\cong\mathbb{Q}\oplus\mathbb{Q}$$
so they are not isomorphic.