The word "masturbation" we commonly use for the act is not found in the Bible. The word itself came from combining the Latin words masturbari (meaning 'hand') and stuprare (meaning 'to defile'). The answer to your question regarding this act depends upon which Biblical standard we are using.
There is one answer Scripture offers, in regard to masturbation, if we are referring to the Law received by Moses (under which the Old Covenant was offered). We get another answer if we use the Christian standard Jesus Christ and the apostles taught as being required under the New Covenant.
In the Old Testament, the primary focus was on the breaking of "the letter" (the narrow, strict interpretation) of the law, which, of course, did not deal directly with masturbation. In the New Testament, the focus shifts towards sin being imputed based on a person's thoughts and goals, judged against the spiritual intent of the law, whether or not any action is taken.
Clearly, the standard believers are held to in the New Covenant is far higher, and more difficult to keep, than what was required under the Old Covenant. This is why the power of God's Holy Spirit needs to reside in a person before they can obey and please him.
It is not just avoiding masturbation but also the thoughts of lust that can lead to it. True Christians do not need the Eternal to write his precepts in stone so that they can follow them but instead must have him write his laws on their hearts (Romans 2:14 - 15).
Spiritual intent of the law
Jesus' famous Sermon on the Mount is noteworthy in many respects. One of its chief characteristics is that, for the first time, God begins to explain the New Covenant offered to all humans as well as revealing the spiritual intent of many of his laws that those who wish to have a relationship with him must follow (Matthew 5:27 - 28).
Jesus reveals that, in order to be considered obedient to God, it is no longer enough for humans not to act on their thoughts and desires.
Those under the Old Covenant were only required to refrain from committing the physical act of adultery (or masturbation). In God's new agreement offered to man, however, which requires the keeping of the commandments both in thought and in deed, lusting for another person in one's heart (before any act is committed) is considered an act of disobedience.
The act of masturbation is not specifically condemned or punished based on "the letter" or strict reading of God's law found in the Old Testament. No verses specifically list it as being unacceptable. That said, based upon the spiritual standards outlined in the New Testament, the lust that generally leads to the act (and, of course, the act itself) is considered sinful.
True love for another person means we should seek not to harm them, in any way, as the Apostle Paul states (Romans 13:10). Christians are commanded to grow toward perfection and stop sinning even in our thoughts. We are promised in the Bible that if we do err in our hearts and lust (whether or not it leads to masturbation) we can be forgiven for our sin if we confess them to our heavenly Father (1John 1:9).