I guess in the days of Onan, the levirate marriage was the only possible means of providing care for the widow and orphans, and therefore desirable. The survival of the tribe depended on keeping birthrate up, so coitus interruptus was justifiably condemned.