The only possible orders for nontrivial proper subgroups are $2$ and $4$. So, if $D_4$ were a direct product of such subgroups, there are only two possibilities.
One possibility is that all of the factors of the direct product have order $2$, so $D_4$ is isomorphic to $C_2 \times C_2 \times C_2$, where $C_2$ denotes a cyclic group of order $2$. But $C_2 \times C_2 \times C_2$ is abelian, and $D_4$ is not, so this possibility is excluded.
The other possibility is that one of the factors has order $4$, hence the other must have order $2$. So $D_4$ is isomorphic to $H \times C_2$, where $H$ has order $4$. But there are only two isomorphism types for a group of order $4$, namely $C_4$ or $C_2 \times C_2$. Both of these are abelian, so $H$ is abelian, hence $H \times C_2$ is also abelian. So this possibility is also excluded.