The statement is obviously wrong, since $1\mid 1$ and $1+1=2$ is a prime.
The correct version should be the sum of the numbers $1, 2, \ldots, n$ divides their product if and only if $n+1$ is not an odd prime.
$\frac{n(n+1)}{2}\mid n!\iff n+1\mid 2((n-1)!)$.
If $n+1$ is a prime, then $n+1\mid 2$ since $n+1>n-1$, so $n=1$, which means that $n+1=2$ is an even prime.
For the other direction, if $n+1=2$, the divisibility condition obviously works.
If $n+1$ is composite then it must be able to be factorized into a product of two numbers $ab$ where $a<b\le \frac{n}{2}\le n-1$, unless $n+1=p^2$ is a square of a prime, in which $2p=2\sqrt {n+1}<n-1\forall p\ge 3$. For $p=2$ we have $n=3$, so $1+2+3=6\mid 6=1\times 2\times 3$. This established the proof.