Praise be to Allah.
If the aim is to obey Allaah, to follow the example of the Messenger of Allaah (peace and blessings of Allaah be upon him), to have a righteous child, to keep oneself chaste and to protect one’s private parts, eyes and heart, etc., then it is one of the actions of the Hereafter and a person will be rewarded for it. If there is no such intention, then it is permissible and is one of the actions of this world which is solely for enjoyment. It will not be rewarded, but there is no sin involved. And Allaah knows best.