There is a widespread <sex-positive view of sexuality>. Many people of course don't share that view. But it's an issue that can be debated without getting into the controversial topic of pedophilia. Here I'm mostly writing for people who are sex-positive before we bring children into the question:
With a sex-positive view, any activity between consenting adults is just fine. Fantasies and fetishes just happen and cover a remarkably wide range. If you can't get a partner to join you, there's no harm in masturbating while thinking about it. Pornography is fun, and watching the kind you like best spices up your life.
Some children masturbate from a young age, and parental concern should be limited to nudging them into doing this only in private. Peers playing "doctor" with each other is natural and not something to police as long as everyone is feeling OK about it. There is no major problem with teens experimenting sexually with each other if they do so freely. People would urge varying degrees of caution with regard to STIs, pregnancy, and possibly emotional consequences, but not because of morality.
The big smiles fade when we bring pedophiles into the picture. Nonconsensual and coerced interactions are possible regardless of the age of participants, but they are in practice a much more serious problem when it's adults acting with children. Even if a child is enthusiastic, she (or he) can often feel betrayed later when she understands what really happened. Even though young teens may have full-blown sexual desires, things just go wrong way too often when they interact with adults. Note that these adult partners of young teens are not pedophiles, but the interactions can still be harmful, and to the outsider it raises the same alarms whether the child is prepubescent or a young teen. I'm with the bulk of society on this basic point -- no adult-child sexual activity. So let's continue assuming the pedophile remains celibate.
Jocelyn Elders famously lost her Surgeon General job for making the benign suggestion that young people might masturbate instead of engaging in risky sexual behavior. The sex-positive view would find this obvious. It would also certainly encourage masturbation if your fantasies are dangerous to others, if you can't find a partner for your particular kink, or if you simply can't find a date who suits you. The lack of suitable partners would suggest this masturbation fallback for pedophiles. But is it OK? Some sex-positive people would hesitate.
Child pornography raises other issues, so let's stick to the simplest case -- with eyes closed, a pedophile imagines a sexual encounter with a generic child of his preferred age and gender and masturbates. Is this OK?
There are some obvious reasons to abstain that I have learned of from Virtuous Pedophiles members. Some hate their attractions and masturbating to such fantasies ends up making them feel much worse about themselves. Some think it will make them more likely to offend against a child -- and I've never heard a better reason to abstain from fantasy. Even if we had reason to think their fears might actually be overblown, it's far better to be safe.
I suspect that the vast majority of those who treat sex offenders would urge pedophiles not to fantasize. Given the data they have to work with, it is an understandable conclusion. A man commits a sex offense against a child. Researchers interview him and get the sequence of events that led up to the offense. With many such interviews at hand, they publish papers making recommendations. You read the research and then urge the pedophile in your office to stop getting drunk or spending time alone with children. You certainly recommend against anything that involves thinking of children sexually. You will naturally argue against looking at child pornography (a crime in its own right) but also against looking at legal pictures of children, reading sexual stories involving children, or masturbating while thinking about children. There may not be high-quality research indicating that these are effective measures, but they also seem like common sense. The recommendations extend to celibate pedophiles as well, because before a sex offender committed his first offense he was celibate, and sexual fantasy involving children likely happened before he crossed the line.
I argued in <a previous post> that professionals who deal with sex offenders could naturally but erroneously conclude that all pedophiles are sex offenders, since they've rarely met one who hasn't offended. We have exactly the same problem here. Can we get better data?
It turns out that we can. <Milton Diamond and colleagues studied> several US states and countries where pornography was difficult to obtain and then became very easy. Contrary to the expectations of anti-porn activists, sex crimes never went up -- they either stayed the same or went down. The same results apply when child pornography is part of the mix and we track child sex abuse. In the three countries where child porn was legal for a time -- Denmark, the Czech Republic and Japan -- child sex abuse went down. There may be other possible explanations for the decline in any one country, but what is clear is that it didn't go up. A plausible explanation is that many potential sex offenders know that sex with children is wrong but can't control themselves. A satisfying fantasy relieved the tension rather than encouraging activity with children. Child porn is what was actually involved in these cases, but there's no reason to think the effect requires material where children are harmed. "Virtual" child porn would presumably have a similar effect.
This data is better than any studies of sex offenders could ever be in one vital respect. It is not using indirect correlates of harm or biased samples -- it is measuring the harm directly as actual sex offenses against children. There is no sample bias because there is no sample -- these are studies of the population!
A schematic reconciliation of the country-wide results with studies of offenders is easy enough. Imagine two men on the verge of committing a sex crime. One looks at one erotic video, then later abuses a child, is caught, and is studied as a sex offender. The other looks at an especially satisfying erotic video, doesn't abuse a child, and remains invisible to sex offender research. Based on the case they see, the research on offenders will erroneously suggest that the erotic video contributed to the abuse.
A reasonable conclusion is that a pedophile who has never offended against a child and doesn't foresee a problem with offending ought to feel free to fantasize and not feel that he is putting children at risk. Diamond's clear result is that the free availability of child porn does not increase child sex abuse. The less clear result is that it decreases it. If that is true, our pedophile masturbating to fantasies of children might be keeping the real ones safer.