Bill and Melinda Gates, two of the richest people in the world, who reshaped philanthropy and public health with the fortune Mr. Gates made as a co-founder of Microsoft, said on Monday that they were divorcing.

For decades, Mr. and Ms. Gates have been singular forces on the world stage, their vast charitable contributions affording them access to the highest levels of government, business and the nonprofit sector. The Bill and Melinda Gates Foundation, with an endowment of some $50 billion, has had immense influence in fields ranging from global health to early childhood education and has made great strides in reducing deaths caused by malaria and other infectious diseases. And over the past year, the couple have been especially visible, regularly commenting on the worldwide fight against Covid-19 as their foundation spent more than $1 billion to combat the pandemic.

“After a great deal of thought and a lot of work on our relationship, we have made the decision to end our marriage,” Mr. and Ms. Gates said in a statement that was posted to Twitter.

They went on to say that they had “built a foundation that works all over the world to enable all people to lead healthy, productive lives” and that they “continue to share a belief in that mission,” but they “no longer believe we can grow together as a couple in this next phase of our lives.”

The foundation said in a statement that Mr. and Ms. Gates would remain co-chairs and trustees and that no changes were expected at the organization.

“They will continue to work together to shape and approve foundation strategies, advocate for the foundation’s issues, and set the organization’s overall direction,” the statement said.

Even so, the divorce will create new questions about the fate of the Gates fortune, much of which has not yet been donated to the Gates Foundation. Mr. Gates, 65, who co-founded Microsoft, is one of the richest people in the world, worth an estimated $124 billion, according to Forbes. The Gateses have been married for 27 years and have three children.

With 1,600 staff members in offices around the world, the Bill and Melinda Gates Foundation gives away roughly $5 billion each year in areas like global public health and development. The foundation tapped its expertise and relationships to play a significant role in formulating the global response to the Covid-19 pandemic, investing early in vaccine candidates and helping shape Covax, the global initiative organizing the purchase of vaccines for 92 poor countries and dozens of other nations.

“Bill and Melinda Gates helped pioneer big philanthropy in its present form,” said David Callahan, founder of the website Inside Philanthropy. “Everything has been outsized.”

While the Gateses did not provide details of how they would structure their finances, they are believed to have a prenuptial agreement. The Gateses are the largest owners of farmland in America and have vast investments though Cascade Investment, which manages Mr. Gates’s personal wealth and owns large stakes in the Four Seasons hotel chain, the Canadian National Railway and AutoNation, the country’s largest chain of car dealerships, among other companies. The family owns multiple homes and properties, including a 66,000-square-foot mansion in Washington.

Mr. Callahan said that Ms. Gates, 56, could assume even more influence in the years ahead.

She already has her own firm, Pivotal Ventures, which she has used to invest in issues related to women’s economic empowerment. Should she receive a portion of Mr. Gates’s Microsoft holdings, she could set up a new foundation or make direct gifts to other causes she supports.

“You could imagine Melinda Gates being a much more progressive giver on her own,” Mr. Callahan said. “She’s going to be a major force in philanthropy for decades to come.”

In 2019, Jeff Bezos, the founder of Amazon, and his longtime wife, MacKenzie Scott, divorced. Ms. Scott received Amazon shares worth $36 billion at the time and immediately set about giving away billions of dollars in direct grants to a range of progressive organizations.

Mr. Gates has recently stepped back from some of his business activities. Last year, he left Microsoft’s board of directors, as well as the board of Berkshire Hathaway, the conglomerate run by his close friend Warren Buffett.

Mr. Buffett has donated billions of dollars to the Gates Foundation over the years and has pledged to leave the majority of his fortune to the foundation when he dies. In 2010, Mr. Buffett and the Gateses created the Giving Pledge, an effort to get wealthy individuals to commit to donating a majority of their money to charitable causes.

Mr. and Ms. Gates have faced relationship struggles over the past several years, two people close to them said. There were several times when the relationship neared collapse, but they worked to keep it together, the people said. Mr. Gates decided to step down from the boards of Microsoft and Berkshire Hathaway, in part, so he could spend more time with his family, these people said.

“When he was having trouble making the decision about getting married, he was incredibly clear that it was not about me, it was about ‘Can I get the balance right between work and family life?’” Ms. Gates said in an interview in 2019 in The Sunday Times of London. “And, believe me, I can remember some days that were so incredibly hard in our marriage where you thought, ‘Can I do this?’”

Nicholas Kulish contributed reporting.