First of all, the Lord is telling us that the act of Adultery and the act of thinking about adultery are on an equal plain of sinfulness from God's perspective. As Christians, we need to be careful not to do what the world does, that is to view sin from man's perspective. Jesus is saying to us that the act or the thought of adultery are both sinful. The moment a man or a woman begins to focus on pleasing themselves sexually, they're oppening their mind up to lusting in the mind, which is sinful.
Pornography entices people to think, to look and to please self.
Here lies one of the biggest problems with masturbation. You're setting yourself up to think about or imagine a sexual partner. All of which is Sin before God. If you're a Christian, your heart and mind should not be full of adultery, but rather your heart should be full of pure things and God honoring things. He made a vow with his heart and with his eyes not to look were he should not, not to look upon women to lust.