We are dealing here with a very broad issue (our children and sex) therefore, we find it crucial to cover it from all its different perspectives. It is tremendously wrong to deal with it from one side only: the Shari`ah (Islamic jurisprudence), the parental, the health, the psychological, the social, the moral. And as Islam is the reference and guide for Muslims.
In essence, both are major sins. Because of this, We cannot say which—masturbation or pre-marital sex—is worse. We cannot separate the religious aspects from the physical or sociological aspects. The fact that we recognize these acts as sins means that we cannot condone either one of them.
It is agreed that, especially now, sex education for our teenagers and young adults is critical. They must understand the changes that their bodies are going through and recognize that there are other ways of dealing with the desires and feelings they have. This education should be provided in an environment as emotionally safe and comfortable for the child as possible.
It is best for mothers to talk to their daughters and fathers to talk to their sons. If the nature of their relationship does not allow this, then the parents may approach an aunt or uncle. An adult of the opposite sex, especially outside of the family, should not talk with a child about these subjects, especially on a one-to-one basis. If a child approaches an adult, they should delay the discussion until someone appropriate can talk with them.
In addition to educating our children, we must recognize what elements are affecting our children’s beliefs and actions. Let us look at how our children are spending their time. Many of the television shows, movies, and even magazines use subliminal messages to appeal to teenagers and adults. These messages reach our subconscious minds without us ever knowing. Why do our mouths water when we see some commercials for food and not others? Why do our children beg for toys and other things they have never seen in real life? We should encourage our children to find appropriate, fun, and physically beneficial activities. Better yet, Moms and Dads join your kids for some of those activities.
Another area of concern is the foods that we put on our children’s plates everyday. Many foods are laden with chemicals and hormones. These hormones, combined with what is all ready going on in their bodies, make their natural feelings become exaggerated and unnatural.
It is extremely important that parents stop hiding from this topic. If we as parents do not educate our children, then we only have ourselves to blame when our children turn to inappropriate and, in fact, haram acts.

Sister Ruqaiyyah Maqsood said:
The two issues of masturbation and sex before marriage are as old as humanity itself. There is nothing new in either practice. However, in Islam, we are asked to keep certain rules of life in order to be pleasing to Allah. The most important is that He has requested us not to have any sexual intimacy with any person outside the marriage relationship. This means both before marriage, and with any person other than the spouse after marriage. In today’s world, when it is well known that some people have hundreds of different partners and think nothing of it, this has become quite a strain on our young people.
Masturbation has always been discouraged and regarded as a highly embarrassing subject. Few people are willing to admit that they do it or have done it and many would find it impossible to talk about it. However, as you say, it is something that has frequently been made use of when the frustrations of living without sex at all, or with very unsatisfactory sex, have driven people crazy with frustration, hormonal troubles, and mental and psychological states, which is unhealthy. Allah intended us to live in pairs, and this is the natural way. For His own reasons, Allah created strong urges in us and sexual equipment. They are gifts, and not to be despised.
In less educated times, people used to say that masturbation would cause blindness or impotence or some such thing; the obvious point of all that was to stop people doing masturbatory things, although what people do in private is usually left to them and their own sense of right or wrong.
What seems to me to be very wrong and unhealthy, is if an individual delays marriage until very late in life and, until that time, practices solitary sexual fulfillment as their regular habit; it then makes it very hard to adjust to sex with a partner and can cause all sorts of marital problems.
It is possible to argue that whereas sexual intimacy with someone outside of marriage (of any sex) is haram (forbidden by Allah), masturbation falls under other categories.