In the case of prostitution the law comes into play; if it's illegal then the prostitute knows they're breaking the law. And even if it's not there is enough intrinsically wrong with sexual immorality that those who commit it know it's wrong in their hearts.