Question: In Hinduism, is having premarital sex a sin?
Answer: Sex is chiefly motivated by lust, which is at the core of sinful activity.
The Supreme Personality of Godhead said: It is lust only, Arjuna, which is born of contact with the material mode of passion and later transformed into wrath, and which is the all-devouring sinful enemy of this world. (BG 3.37)
An exception is made for sex according to religious principles, which is only within marriages:
BG 7.11: I am the strength of the strong, devoid of passion and desire. I am sex life which is not contrary to religious principles, O lord of the Bharatas [Arjuna].
The punishment is continued suffering in material existence.