Josephine Edna O'Brien was born in 1930 to Michael O'Brien and Lena Cleary at Tuamgraney, County Clare, Ireland, a place she would later describe as "fervid" and "enclosed". According to O'Brien, her mother was a strong, controlling woman who had emigrated temporarily to America, and worked for some time as a maid in Brooklyn, New York, for a well-off Irish-American family before returning to Ireland to raise her family. O'Brien was the youngest child of "a strict, religious family". From 1941 to 1946 she was educated by the Sisters of Mercy – a circumstance that contributed to a "suffocating" childhood. "I rebelled against the coercive and stifling religion into which I was born and bred. It was very frightening and all pervasive. I'm glad it has gone." She was fond of a nun as she deeply missed her mother and tried to identify the nun with her. In 1950, O'Brien was awarded a licence as a pharmacist. In Ireland, she read such writers as Tolstoy, Thackeray, and F. Scott Fitzgerald.
In Dublin, O'Brien bought Introducing James Joyce, with an introduction written by T. S. Eliot, and said that when she learned that James Joyce's A Portrait of the Artist as a Young Man was autobiographical, it made her realise where she might turn, should she want to write herself. "Unhappy houses are a very good incubation for stories," she said. In London she started work as a reader for Hutchinson, where on the basis of her reports she was commissioned, for £50, to write a novel. She published her first book, The Country Girls, in 1960.
This was the first part of a trilogy of novels (later collected as The Country Girls Trilogy), which included The Lonely Girl (1962) and Girls in Their Married Bliss (1964). Shortly after their publication, these books were banned and, in some cases burned, in her native country due to their frank portrayals of the sex lives of their characters. O'Brien herself was accused of "corrupting the minds of young women"; she later said: "I felt no fame. I was married. I had young children. All I could hear out of Ireland from my mother and anonymous letters was bile and odium and outrage".
In the 1960s, she was a patient of R.D. Laing: "I thought he might be able to help me. He couldn't do that – he was too mad himself – but he opened doors", she later said. Her novel, A Pagan Place (1970), was about her repressive childhood. Her parents were vehemently against all things related to literature; her mother strongly disapproved of her daughter's career as a writer. Once when her mother found a Seán O'Casey book in her daughter's possession, she tried to burn it.
O'Brien was a panel member for the first edition of the BBC's Question Time in 1979. In 2017 she became the sole surviving member.
In 1980, she wrote a play, Virginia, about Virginia Woolf, and it was staged originally in June 1980 at the Stratford Festival, Ontario, Canada and subsequently in the West End of London at the Theatre Royal Haymarket with Maggie Smith and directed by Robin Phillips. It was staged at The Public Theater in New York in 1985. Other works include a biography of James Joyce, published in 1999, and one of the poet Lord Byron, Byron in Love (2009). House of Splendid Isolation (1994), her novel about a terrorist who goes on the run (part of her research involved visiting Irish republican Dominic McGlinchey, later shot dead, whom she called "a grave and reflective man"), marked a new phase in her writing career. Down by the River (1996) concerned an under-age rape victim who sought an abortion in England, the "Miss X case". In the Forest (2002) dealt with the real-life case of Brendan O'Donnell, who abducted and murdered a woman, her three-year-old son, and a priest, in rural Ireland.
In 1954, O'Brien met and married, against her parents' wishes, the Irish writer Ernest Gébler and the couple moved to London – "We lived in SW 20. Sub-urb-ia." They had two sons, Carlo (a writer) and Sasha Gebler, an architect, but the marriage was dissolved in 1964. In 2009 Carlo revealed that his parents' marriage had been volatile, with bitter rows between O'Brien and Gébler over his wife's success. Initially believing he deserved credit for helping her become an accomplished writer, he came to believe he was the author of her books. Gebler died in 1998.