The Word of God does not offer any direct guidance on the subject of masturbation. I believe the reason for the omission is because this is a moral issue that needs to be left up to the individual to determine right from wrong.
From a biological viewpoint, masturbation itself would appear to be a common function of sexuality. The real area of concern should be what goes on in a person’s mind. If during the act, someone is having adulterous thoughts about his neighbor’s wife, Matthew 5:28 comes to mind “whosoever looketh on a woman to lust after her hath committed adultery with her already in his heart.”
For people who have a deep struggle with masturbation, I would say that we all still have our old sinful nature, which strikes in times of weakness. Because no one has reached the state of perfection, God’s grace is continuous process that is there to cover all the sins we commit.