The company also settled with two other women who were part of a Fox-initiated investigation by the law firm Paul, Weiss, Wharton & Garrison, according to the source, who wished to remain anonymous.
The settlements come less than two months after Fox News' parent company, 21st Century Fox, hired Paul, Weiss to investigate claims against Ailes. During that investigation, more than two dozen women described harassment by Ailes, according to New York Magazine.
In a move that legal experts said was unusual, 21st Century Fox offered a public apology to Carlson, who filed suit against Ailes in July, saying he took her off a popular show and cut her pay because she refused to have a sexual relationship with him.
"We sincerely regret and apologize for the fact that Gretchen was not treated with the respect and dignity that she and all of our colleagues deserve," the company said.
While the settlement removes some uncertainty, observers said questions remain about the conservative news channel's ability to retain top talent and whether more allegations will surface.
Fox News also announced on Tuesday that Greta Van Susteren, host of "On the Record," was leaving the network after 14 years.
A court filing showed Carlson, 50, had voluntarily dismissed her federal lawsuit in New Jersey against Ailes. In a statement, she said she was grateful Fox took swift action.
The source said Ailes' contract indemnified him from employment-related claims, which was why the company was settling on his behalf.
Attorneys for Ailes did not return calls for comment.
"INDECENCY AND MISOGYNY"
Fox News still is fighting sexual harassment claims in a New York state court. Former anchor Andrea Tantaros claimed she was taken off the air in April in retaliation for rebuffing Ailes' advances and complaining to top officials at Fox News.
Behind the scenes, her lawsuit said, Fox News was "a sex-fueled, Playboy Mansion-like cult, steeped in intimidation, indecency and misogyny." Fox News characterized Tantaros as an "opportunist" who was taken off the air for writing a book without permission.
The speed with which Fox settled with Carlson suggested it may settle with Tantaros, said Dan Eaton, a San Diego State University business ethics lecturer and employment attorney.
Ailes, a former political consultant who founded the conservative news operation in 1996, left Fox less than three weeks after Carlson filed suit, taking a $40 million severance package. Tantaros and other women who had worked for him then came forward with more harassment allegations.
Ailes had said Carlson's lawsuit was in retaliation for the network's decision not to renew her contract after disappointing ratings for her show.
A $20 million settlement is high for a sexual harassment case but not surprising given the high profile of the people involved, said Douglas Wigdor, a New York City employment lawyer who represents employees.
"Any settlement is going to take into account how much the (plaintiff) was earning, as well as the notoriety of the person being accused,” said Wigdor, who is not involved in the case.
Fox News, which generated more than $1 billion in earnings before interest, taxes, depreciation and amortization for 21st Century Fox in fiscal 2016, is the most watched channel in basic cable television this year, according to Nielsen ratings data.
In his resignation letter, Ailes did not indicate he had done anything wrong. He previously denied Carlson's allegations, as well as those of star anchor Megyn Kelly.
New York magazine reported in July that Kelly had told investigators hired by Fox that Ailes "made unwanted sexual advances toward her" about 10 years ago.
Van Susteren's departure was related to a financial disagreement with her employer, according to a separate source familiar with the situation, who requested anonymity because discussions were confidential. The source declined to say if her departure was connected to Ailes' resignation.
Shares of 21st Century Fox fell less than 1 percent Tuesday, versus a slight gain for the broader stock market, and closed at $24.42 on the Nasdaq.