Onan died for disobedience.
He disobeyed God by spilling his seed. He needed a lecture from Christine to cut it out.