As the Wikipedia article on Masturbation summarizes, the current consensus among scientists is that masturbation has no negative effects whatsoever, and that all known positive effects are physiological (e.g. reduction of the probability to have prostrate cancer in men over 50) or on the level of general well-being (e.g. it relieves depression and leads to higher self-esteem).
A quick Google Scholar search turned up no results for studies into the relation between masturbation and cognitive functions such as memory, attention etc. This does not mean that masturbation does not affect these functions, positively or negatively, only that apparently this has not been studied.
Sexual stimulation and orgasm activate the parasympathetic nervous system, leading to a production of sex specific sex hormones as well as neurotransmitters such as acetylcholine, dopamine, and serotonin, which in turn affect the relevant neurotransmitter systems.
Too much masturbation may lead to loss of libido (psychological) and loss of sensitivity (physiological), though what is too much will differ between idividuals. Certainly during adolescence most teenagers indulge in extensive sexual self-exploration with no apparent negative consequences.
As Archimedix pointed out, one study found that frequent masturbation in male teenagers correlated with higher probability of prostrate cancer. But the researchers surmised that it is not the masturbation that causes the hormones that cause the cancer, but rather the hormones cause both the higher sex drive and the cancer. So again masturbation appears not to have a negative effect, and not masturbating would not have prevented cancer, but the causation is all speculation either way. (http://www.webmd.com/prostate-cancer/news/20090127/masturbation-and-prostate-cancer-risk).
Rather, the common consensus among sexologists is to encourage teens and even children to actively exlore this area. For example, the European Regional Bureau of the WHO suggests that masturbation can help an individual better understand their sexual needs and boundaries, communicate more clearly in a sexual situation, and avoid being abused (http://www.bzga.de/infomaterialien/einzelpublikationen/?idx=2042, in German).
Like any activity, for example excessive working, masturbation can become problematic. But like work, masturbation is not problematic in and of itself.