Let f be a ring epimorphism from R onto S, with kernel K. We know that ideals in R containing K correspond to ideals in S. Verify that the xRy test is satisfied in R iff it is satisfied in S. Therefore an ideal is prime iff its image or preimage is prime.
Note that ideal correspondence, and prime ideal correspondence, hold, even if R does not contain 1.
When ideals don't contain the kernel, all bets are off. For instance, the multiples of 6 are not prime in Z, but they map to Z2 in Z4, a maximal/prime ideal.
For the converse, let K be a field and let R be K[x,y]/xy. These are the polynomials in x and y with no mixed terms. Let P be the ideal generated by y. Since R/P is K[x], an integral domain, P is prime. Now consider R mod x2. These are polynomials in y, with one possible linear term in x. The ideal P, generated by y, is no longer prime, since it contains x×x, and x is not in P.