According to this answer, does it mean that premarital sex was non-existent?
Is prostitution related to premarital sex? If not then any scriptural references on the same topic?
"... does it mean that premarital sex was non-existent?"
If a boy & girl adore each other and consummate the relationship, then such act was called GAndharva marriage. In such case, girl's wish was considered foremost. So in the context of your question, "pre-marital sex" would become marriage itself. Here is from AnushAsana Parva:
Bhishma said, ... When the father of the girl', disregarding his own wishes, bestows his daughter upon a person whom the daughter likes and who reciprocates the girl's sentiments, the form of marriage, O Yudhishthira, is called Gandharva by those that are conversant with the Vedas. ... The Brahma, Kshatra, and Gandharva forms are righteous.
Now probably your question is more about, "What about premarital sex, which is done without commitment of marriage?"
"Premarital sex" as such, is seen with negative views. In earlier times, it was bit 1 sided. For men, it was sometimes OK & for women it was forbidden. In the same quotes, Bhishma continues:
Some say that persons belonging to the three higher orders may take, only for purposes of enjoyment (and not for those of virtue), wives from the lowest or the Sudra order. Others, however, forbid the practice.
However, even though 2 major women of Mahabharata had premarital sex, without entering into the marriage, they are always regarded as Pious. Those women were Satyavati & her daughter in law Kunti. Not only premarital sex, but they also begotten children from this act. Those were VyAsa (considered as an incarnation of god) and Karna (considered a very brave warrior & eldest among PAndava-s).
Prostitution is different aspect and not related to above. Prostitution is not seen with favourable eyes either. Even eating food cooked by prostitute is not recommended:
... The food provided by a usurer is equivalent to dirt, while that provided by a woman living by prostitution is equivalent to semen. The food also provided by persons that tolerate the unchastity of their wives, and by persons that are ruled by their spouses, is forbidden....
Having said all these, I do believe that few of the things may not be applicable in today's intermingled world. Hence people should keep morality & ethics as personal things and refrain judging others. In some of the "not so old" Indian cultures, prostitutes were also respected & were called "Nagar Vadhu" (City's wife). There was story of a prostitute, who got liberation. While a learned Brahmana still returned to earth.
Some statures in the life are respectable, and some are not so good. However, a person always has a chance to act in his/her own duty & leave all the reaction to the supreme. This is what matters for liberation.
Hinduism considers prostitutes to be women who are ignorant about dharma.
Pingala said, ‘…What women is there that regards that Supreme Soul as her dear Lord, even when he comes near? I am now awake. I have been roused from the sleep of ignorance. I am no longer influenced by desire. Human lovers, who are really the embodied forms of hell, shall no longer deceive me by approaching me lustfully. Evil produces good through the destiny or the acts of a former life. Roused (from the sleep of ignorance), I have cast off all desires for worldly objects. I have acquired a complete mastery over my senses. One freed from desire and hope sleeps in felicity.Freedom from every hope and desire is felicity. Having driven off desire and hope, Pingala sleeps in felicity.
Mahabharata Santi Parva Section CLXXV
Hinduism does not support premarital sex.
Dharma, understood as the Supreme Good of man, can never have wealth as its reward. Nor has wealth, understood as an aid to the achievement of Dharma, been conceived as an aid for the attainment of kama (sexual desire). Kama in its turn is not a call to indulgence in sexual pleasures, but a mere inducement implanted by the Creator to make life unbroken. And as for life, it has the quest of the Supreme Truth as its end – not certainly Karma (i.e. performance of rituals and social duties) for the attainment of wealth (prosperity here and heaven hereafter).
Srimad Bhagavata Purana I.2.9-10