This is easy to see in the ring of integers. In fact, the ideals don't even have to be prime. It's enough to be coprime. Then their GCD is 1, so 1 can be written as a linear combination of the generators of your ideals, and once you get 1 in the ring, you have the whole ring.
Is this true for rings in general? If not, what conditions must we impose on the ring (euclidean domain, principal ideal domain, etc.) in order to make it true?
What about the prime ideals $(X)$ and $(Y)$ in $K[X,Y]$?
A class of rings where happens what you want is that of Bezout domains. (PIDs are Bezout domains.)