This is true, provided that the specific root is in the range $\{ 1, \dots , p-1\}$. In other words: let $a$ be a root of $-1$ mod $p$ and mod $q$ with the conditions $0<a<p$, $0<a<q$. Then necessarily $p=q$.
Indeed, suppose by contradiction that $p\neq q$. If $a^2+1 \equiv 0 \pmod{p}$ and $a^2+1 \equiv 0 \pmod{q}$, then $pq$ divides $a^2+1$. In particular we have $pq \le a^2+1$. But now,
$$a^2 \le (p-1)(q-1)=pq -(p+q-1) \le a^2+1-(p+q-1) =$$$$ = a^2- (p-1)-(q-1) \le a^2-2a $$
and this implies the contradiction $a \le 0$.
But without our condition, then this is false. For example for $a=8$ we have $a^2+1=65= 5 \cdot 13$, so that $8$ is a square root of $-1$ both mod $5$ and mod $13$. The problem here is that $8 \mod{5}=3$, so $8$ is "hidden behind" $3$.