The 23-time grand-slam champion won her first singles match for more than a year at the National Bank Open in Toronto on Monday evening but has revealed in a first-person piece for Vogue that she has decided to end her career.
“I’m here to tell you that I’m evolving away from tennis, toward other things that are important to me,” she wrote.
Williams revealed a desire to have a second child is behind her motivation to call it quits on the court.
She said she was trying for another baby with tech entrepreneur husband Alexis Ohanian during her absence from tennis for a year until Wimbledon this summer.
She returned to the sport early in 2018 following the birth of daughter Olympia the previous year, having been pregnant when she won her last slam title at the Australian Open.
“I’m turning 41 (in September), and something’s got to give,” Williams wrote in Vogue.
“In the last year, Alexis and I have been trying to have another child, and we recently got some information from my doctor that put my mind at ease and made me feel that, whenever we’re ready, we can add to our family.
“I definitely don’t want to be pregnant again as an athlete. I need to be two feet into tennis or two feet out," she added.
'I'm terrible at goodbyes'
Williams has already committed to playing at the Western & Southern Open in Cincinnati next week as well as the US Open in New York later this month, but it appears that will be her final tournament.
“Unfortunately I wasn’t ready to win Wimbledon this year,” the 40-year-old said.
“And I don’t know if I will be ready to win New York. But I’m going to try. And the lead-up tournaments will be fun.
“I know there’s a fan fantasy that I might have tied Margaret (Court on 24 slam singles titles) that day in London, then maybe beat her record in New York, and then at the trophy ceremony say, ‘See ya!’
“I get that. It’s a good fantasy. But I’m not looking for some ceremonial, final on-court moment. I’m terrible at goodbyes, the world’s worst.”
Williams admitted the decision to leave tennis is a heart-wrenching one, saying: “It’s the hardest thing that I could ever imagine. I hate it. I hate that I have to be at this crossroads.
"I keep saying to myself, ‘I wish it could be easy for me’, but it’s not.
“I’m torn. I don’t want it to be over but, at the same time, I’m ready for what’s next.
She described the end of her sporting career as "the end of a story that started in Compton, California, with a little black girl who just wanted to play tennis.”
Want a quick and expert briefing on the biggest news stories? Listen to our latest podcasts to find out What You Need To Know...
Who are tennis power-duo sisters Serena and Venus Williams?
Serena Williams has 23 grand slam singles titles to her name - the most in the Open era, and 39 slam titles overall.
But it has not been a journey she has undertaken alone, as she has been joined by her elder sister, fellow tennis pro - and oftentimes fierce competitor -Venus Williams.
There are only 15 months between Serena and Venus, and the star sisters’ relationship has formed the centre of their lives and careers.
The emergence and subsequent dominance of the sisters forced tennis to confront - not always willingly - its attitudes to race and strong women on the court.
Serena followed her older sister into the sport on glass-strewn courts in Compton, Los Angeles. The dynamic has played out through their professional careers - with Venus leading the way but swiftly being overtaken by Serena, the younger sister’s determination to have things her way making her a steely competitor.
Serena was the first of the pair to win a slam singles title, at the US Open in 1999 - just a couple of weeks short of her 18th birthday. The excitement around the sisters was enormous but, as they grew to become dominant forces in the women’s games, tennis grew less welcoming.
Home support was far from guaranteed in the US. One high profile episode came at the Indian Wells Masters in 2001 when fans jeered Serena after suspecting foul play in Venus’ withdrawal ahead of a semi-final clash with her sister.
Venus and the siblings' father, Richard Williams, said they were racially abused in the stands.
The sisters boycotted the event for more than a decade.
Away from tennis, Serena has always pursued her interests, particularly in fashion and philanthropic work in Africa.
She and Venus founded the Yetunde Price Resource Center in memory of their murdered half-sister to help families affected by violence in Compton.
Serena has found a growing political voice on black and gender rights and, following the birth of her daughter, as a mother.