"Many people think that the worship of God consists in putting on white garments. Others think that regular, daily attendance at services or sleeping perpetually in the bethel constitute the worship of God. The important thing is to practice His words and keep His commandments. And what are His commandments? Till dooms day, I shall not finish expatiating on the laws of God, all this while I have merely dealt with the preliminary part of it. Remember the commandment given to Moses that no one should commit adultery. Today the same law is given to you again. The Bible says we should not fornicate as some people fornicated and died twenty three thousand a day. The commandment is given to you that you be holy physically and spiritually to enable Jehovah God and His Christ to dwell in you. God and his Christ will not dwell in the body of a fornicator. It is said "Be Holy as I am Holy" sinfulness does not dwell with me."
This applies not only to fornication and adultery, it also applies to sexual fantasies/masturbation (lustful thoughts).