Purposeful ejaculation of semen, hotza’at zera, is generally permitted only in the context of vaginal intercourse (or occasionally with anal intercourse, see below). Otherwise, ejaculation may violate the prohibition of hotza’at zera levatalah, wasting of seed.
A couple should take hotza’at zera levatalah into account in making decisions about sexual activity so that it does not take place casually or deliberately. At the same time, it is understood that some semen typically comes out prior to ejaculation and that sometimes ejaculation outside of the vagina happens accidentally, and these are not considered a transgression.
A couple do not need to engage in relations solely out of concern that hotza’at zera might otherwise take place unintentionally. Likewise, a couple can proceed with relations at a pace that is comfortable for them, without rushing to reach penetration in order to avoid unintentional ejaculation beforehand.
See here for a discussion of navigating this issue in cases of sexual pain disorder, and here for a discussion of hotza’at zera and semen collection for fertility evaluation or treatment.