The commodification of sex has fascinated writers, playwrights and painters for centuries – but for all the supposed liberation of our times, have attitudes really changed that much?

In the past, women whose lives included selling sex were rarely the subjects of their own histories, but were glamorous, vicious or pitiable objects in others’ accounts. One particular alluring figure turns up in the Christian story of sin, redemption and resurrection recounted in the frescoes of medieval western art. Mary Magdalene, the former prostitute, recognisable by her rippling yellow hair and red cloak, kneels at the foot of the cross, weeping. A mythical figure conflated from three different characters in the Gospels, she also turns up in the Apocrypha.

Renaissance painters loved her. Their images ostensibly defend Christian notions of chaste female sanctity, but simultaneously celebrate the seductiveness of beauty. They painted her costumed as a temptress in furs and jewels, with luscious breasts exposed, and also as a repentant sinner stripped of her finery, with an animal skin thrown over her, only partly hiding her luminous nakedness. Thirty years ago, similarly inspired, I wrote my novel The Wild Girl, claiming Mary Magdalene as a prophet, the author of a fifth Gospel.

In Measure for Measure Shakespeare underlined the virgin/whore dichotomy by juxtaposing the convent and the brothel, both institutions that contained and controlled women. The novice Isabella is vowed to sexual abstinence; Mistress Overdone, the bawd, to sexual availability. They cannot talk to one another: the official morality of the time fosters mutual distrust. Shakespeare’s dramaturgy, however, nudges the audience to link them in imagination.

Facebook Twitter Pinterest Emily Woof as Nancy and Andy Serkis as Bill Sykes in the 1999 TV adaptation of Oliver Twist. Photograph: HTV

By the 19th century, in bourgeois culture, the rules had hardened. The individual gets crushed by the weight of the persona of the “fallen woman”. Novels act as etiquette books. In Jane Austen’s strictly ordered world, a young woman who bears an illegitimate child – such as Eliza in Sense and Sensibility – sinks further and vanishes. Euphemisms abound. And much as Dickens sympathised with young women forced into prostitution through poverty and tried to help them, he could not actually name Nancy’s occupation in Oliver Twist.

In French culture, the image of the prostitute forms part of the fabric of modernity anxiously woven by male poets. Baudelaire, exemplifying the flâneur, talked of “the sacred prostitution of the soul”, meaning that he could mingle minds with chance-met strangers, but places sexually free, wandering women merely as projections of his shadow self. (In English, the double standard equates street-walker with prostitute, not flâneuse.)

In Jane Austen’s strictly ordered world, a young woman who bears an illegitimate child sinks and vanishes

For the French novelists, women living as prostitutes in the “splendour and misery” pinpointed by Balzac function as statuesque allegories of social upheaval and change. Zola’s courtesan heroine, Nana, behaves like a virus, rising from her working-class origins to infect the upper classes with her lust for sex. The prostitute heroine of Maupassant’s “Boule de Suif”, pressured by her travelling companions into servicing a Prussian officer, personifies the submission of France to the occupying forces. Hers is a pointless self-sacrifice; she remains the outcast.

In the early 20th century, Colette broke social and literary taboos. Moving in and out of the demi-monde, she documented it tenderly and honestly in her memoirs of music hall life. In her novella The Rainy Moon, she gives the young woman soliciting on the street a history, a memory. Apollinaire, in Les Onze Mille Verges, a porno-hymn to sexy excess, imagines the brothel as a tantalising playroom where anything goes. Tarts are dolls, to be posed and arranged, as they are in the stylised brothel theatre of Cleland’s Fanny Hill. In the 1930s, Aragon used the figure of the high-class prostitute (“la grande horizontale”) in Les Cloches de Bale to exemplify the rottenness of the capitalist system.

For French 19th-century painting, the closed environment of the brothel was ideal for the study of the female nude. Outside the brothel, a fortunate kept woman such as Manet’s Olympia could stare proudly back at the viewer. Her less fortunate sisters, parading in cafe concerts and cabarets, went on to be portrayed by Toulouse-Lautrec, Degas and Picasso – although the exploitation, violence, disease, prison and mandatory invasive state medical checks are mostly kept out of the picture.

Contemporary western culture, simultaneously pornogrified, hypocritical and repressed, preaches prostitution as just another service industry, a lifestyle choice. Margaret Atwood’s The Handmaid’s Tale satirises these developments to chilling dystopic effect. Having grown up Catholic, I inherited this treasure house of images and stories, and in my new novel, The Walworth Beauty, I explore how the Victorian sociologist Henry Mayhew’s categorisation of prostitutes as workshy criminals still reverberates for rebellious modern women concerned with liberation and love. It is salutary that, even today, I needed to challenge misogynistic views of women divided into Good and Bad.

• The Walworth Beauty by Michèle Roberts will be published by Bloomsbury on 20 April.