Penguin Random House will publish coming books by former President Barack Obama and the former first lady Michelle Obama, the publishing company announced Tuesday night, concluding a heated auction among multiple publishers.

The terms of the agreement were not disclosed, but publishing industry executives with knowledge of the bidding process said it probably stretched well into eight figures. Robert B. Barnett and Deneen C. Howell of Williams & Connolly represented the Obamas.

Penguin Random House acquired world rights to the books, and worldwide sales could be substantial. No decision has been made yet as to which of the company’s major imprints — which include Random House, Doubleday, Alfred A. Knopf and Crown — will publish the books. Mr. Obama’s previous books were published by Crown, which also published Mrs. Obama’s book “American Grown,” about the White House garden.

A spokeswoman for Penguin Random House would not say whether the books would be memoirs and referred questions to representatives of the Obamas.

Speculation about the Obamas’ books and how much they would sell for have been circulating in the industry in recent weeks, as executives at the top publishing houses met separately with the former president and first lady. Some publishing executives who followed the bidding process said that the opening offers for Mr. Obama’s book alone were in the $18 million to $20 million range.

The publisher plans to donate one million books in the Obama family’s name to First Book, a nonprofit organization that provides books to disadvantaged children, and it will continue to provide digital copies to Open eBooks, which grew out of the 2016 White House digital education initiative. The Obamas also plan to donate part of their advances to charity, including the Obama Foundation.

“We are absolutely thrilled to continue our publishing partnership with President and Mrs. Obama,” Markus Dohle, the chief executive of Penguin Random House, said in a statement. “With their words and their leadership, they changed the world, and every day, with the books we publish at Penguin Random House, we strive to do the same. Now, we are very much looking forward to working together with President and Mrs. Obama to make each of their books global publishing events of unprecedented scope and significance.”

The Obamas’ advance is likely to exceed even the stratospheric figures that other recent presidents and first ladies have received. Former president Bill Clinton sold his memoir “My Life” for more than $10 million, and Hillary Clinton reportedly received an $8 million advance from Simon & Schuster for her memoir “Living History.” George W. Bush’s memoir “Decision Points,” became a hit, selling about two million copies and earning him an estimated $10 million. (Mr. Barnett, a Washington-based lawyer, has handled many of these lucrative deals and represents some of the capital’s most powerful players, including the Clintons; Mr. Bush and his wife, Laura Bush; Speaker Paul D. Ryan and former Vice President Dick Cheney.)

It is unusual, however, for a former president and first lady to make a collective deal for their memoirs, and some publishing industry insiders said that early on the process, it appeared that the books were going to be auctioned separately. (It is possible, and perhaps likely, that the books will be published by different imprints in the Penguin Random House conglomerate, which could also help the company absorb the cost of a large advance, by sharing it between imprints.)

Mr. Obama has a proven track record in publishing as an author of multiple best sellers. His three books — “Dreams From My Father,” “The Audacity of Hope” and “Of Thee I Sing” — have sold more than four million copies. According to financial disclosures, he earned more than $10 million from those titles. Reviews have praised him as a gifted prose stylist.

But a postpresidential memoir has even greater potential to be a critical and commercial hit. Mr. Obama kept a journal during his time in office, which suggests his memoir could include behind-the-scenes moments that were captured as major events unfolded.

A frank discussion of his time in the White House, and of issues like race relations in America, could reach an even wider audience, becoming a worldwide blockbuster. Penguin Random House, a global publishing house with more than 250 imprints, has worldwide rights to the books, which means the company can make a good deal of money overseas and in translation.

For the Obamas, the books may be valuable beyond the multimillion-dollar advances. The deal was announced, probably coincidentally but somewhat awkwardly, on the night that President Trump gave his first address before Congress. These books could provide a chance to reframe and highlight the former president’s legacy, at a moment when a new Republican administration is making an effort to dismantle some of his signature legislation.

Correction:March 4, 2017

An article on Wednesday about book deals that former President Barack Obama and Michelle Obama made with Penguin Random House referred incorrectly to books that the publisher plans to donate. It will donate one million print books to First Book in the Obamas’ name and will continue to provide digital copies to Open eBooks; it will not donate a total of one million books to both of those organizations. And because of an editing error, the article misstated, in some editions, part of the title of a book by Mrs. Obama. It is “American Grown,” not “American Green.”

A version of this article appears in print on , on Page B3 of the New York edition with the headline: Obamas Sell Book Rights to Penguin Random House. Order Reprints | Today’s Paper | Subscribe