It is a no brainer. Babies play with their genitals as part of exploring their bodies and children who are not forced to stop continue to do so and eventually orgasm by accident. If sex with a partner satisfies all of a person's sexual needs, they won't need to masturbate, but if it does not, they will continue to masturbate. Besides, the males of gatherer/hunter societies may be gone for long periods of time time hunting. If a separated pair do not want to risk having sex outside of their partnership, they can masturbate.