From Factorisation of semiprimes to breaching confidentiality
I guess it depends on which scenario you are referring to. If it is RSA, being able to factorize $n = pq$ would compromise the security of that crypto-system.

This is because one could compute $\phi(n) = \phi(p)·\phi(q) = (p-1)·(q-1)$ since $p$, $q$ are two distinct primes and could calculate the private key $d$ from the public key $e$ by using the equation $e \cdot d = 1 \mod \phi(n)$.