The British writer said she had suicidal thoughts in her mid-20s, when she was a single mother and struggling to establish a literary career.
"Mid-20s life circumstances were poor and I really plummeted," Rowling said, according to an interview posted online by student journalist Adeel Amini.
Rowling said in the interview, parts of which were published in Edinburgh University's Student magazine, that she sought help from doctors and spent nine months receiving cognitive behavioral therapy, according to Amini.
"We're talking suicidal thoughts here, we're not talking 'I'm a little bit miserable,'" Rowling was quoted as saying.
Amini provided The Associated Press with an audio file of his 29-minute conversation with Rowling.
Christopher Little, Rowling's London-based agent, did not immediately respond to requests for comment.
Rowling has previously said she suffered depression before her Harry Potter series brought her international success. She has acknowledged that characters featured in the series called Dementors were inspired by her illness.
The author has said she sought medical help following her separation from first husband, Jorge Arantes, a Portuguese journalist.
Amini told the AP in an e-mail that he had carried out the interview in Edinburgh last month. He said Rowling granted him an interview after a chance meeting several months ago in a coffee shop in the city.
"I have never been remotely ashamed of having been depressed. Never," Rowling was quoted as saying in her interview with Amini. "What's to be ashamed of? I went through a really rough time and I am quite proud that I got out of that."
Fortune magazine ranks Rowling, who wrote seven Harry Potter novels, as one of the richest women in Britain, with an estimated wealth of $1 billion.