We're looking for a rule about what should be legal.

First Attempt: You can do anything you want as long as you're not hurting anybody. This doesn't work very well, because anything you do is liable to hurt someone. You can enrage, sadden and depress people by riding on the Sabbath, reading Karl Marx or loving someone of the same gender. Those are all forms of harm, but most of us believe they're the sort of harms that the law should ignore. So "as long as you're not hurting anybody" is the wrong way to put this.

Second Attempt: You can do anything you want as long as you're not causing anybody direct physical harm. This allows you violate the Sabbath and read Marx, but it would also allow you to rape an unconscious victim if there were no physical consequences. That seems grotesque, so this rule seems wrong too.

Therefore the second attempt fails, and we're left flailing around looking for a better rule. Unfortunately, I'm not sure how to solve this problem. The end.

The reason rape gets mentioned here is because rape is particularly bad, so we can be quite sure we don't want to adopt a rule that might allow it, even in the extreme hypothetical case with no physical damage. In other words, it's mentioned because it's horrible.

The whole point here is that the second attempt seems to allow rape. Some readers might have thought that was an argument for rape. It wasn't; it was an argument against the second attempt.