No human being is harmed by masturbation just as no human being is harmed by menstruation. Sperm and eggs are not human beings, they are haploid gametes that require co-mingling of their DNA material to make a new human being.

After this happens, the sperm and egg no longer exist, they become a zygote – a living human being.