Trump said while Shanahan "has done a wonderful job, he has decided not to go forward...so that he can devote more time to his family."
In a second tweet, the president named Army Secretary Mark Esper as his next acting Pentagon chief -- a job which has now been vacant since former Defense Secretary James Mattis resigned in December. Talking to reporters on the White House lawn on Tuesday, Trump said he was "most likely" to name Esper to the post permanently.
The decision for Shanahan to step down coincides with media reports from USA Today and the Washington Post which detail episodes of domestic violence that occurred in Shanahan's family over a decade ago. According to a U.S. official, Shanahan's aides were growing concerned that his nomination process could be hampered by the reporting.
Trump said that he didn't ask for Shanahan to withdraw from the confirmation process and only learned about the issues in Shanahan's past for the first time on Monday. A senior White House official told ABC News that the White House had been aware of the issues for months, but the official was unaware of how long the president knew.
The Post, which interviewed Shanahan on Monday evening, detailed two incidents: one in which Shanahan's now ex-wife was arrested for punching him in the face and another in which his son was arrested for hitting his mother with a baseball bat, which ABC News has confirmed through Sarasota County, Florida, court records.
ABC News has been unsuccessful in attempts to reach Shanahan's ex-wife.
In a statement the Pentagon issued Tuesday afternoon, Shanahan said, "The confirmation process should focus on securing our nation against threats, readiness and the future of our military, and ensuring the highest quality care and support for service members and their families."
"After having been confirmed for Deputy Secretary less than two years ago, it is unfortunate that a painful and deeply personal family situation from long ago is being dredged up and painted in an incomplete and therefore misleading way in the course of this process," he said. "I believe my continuing in the confirmation process would force my three children to relive a traumatic chapter in our family's life and reopen wounds we have worked years to heal. Ultimately, their safety and well-being is my highest priority."
"I would welcome the opportunity to be Secretary of Defense, but not at the expense of being a good father," the statement continued. "After significant reflection, I have asked to be withdrawn from consideration for Secretary of Defense and will resign my position as Deputy Secretary of Defense. I will coordinate an appropriate transition plan to ensure that the men and women in harm's way receive all the support they need to continue protecting our great nation."
Shanahan, a former Boeing executive, had served as deputy defense secretary and stepped into the role in an "acting" capacity on Jan. 1 after Mattis resigned over policy differences with the president. Shanahan will resign effective midnight Sunday and conclude his service in the Department of Defense at that time, Jonathan Hoffman, chief Pentagon spokesperson, said.
Officials have not determined who from the department will represent the U.S. at the NATO meeting of defense ministers in Brussels on Monday.
Mark Esper, who has served as Army Secretary since November 2017, will then become the acting defense secretary. He is a former senior executive at Raytheon, who also has extensive experience working on Capitol Hill. Esper graduated from the U.S. Military Academy in 1986 -- the same year as Secretary of State Mike Pompeo -- and served in the Army for over a decade, including a deployment to the Gulf War.
He has traveled with Trump several times over the last six months, including a January visit to the southern border where thousands of soldiers have been deployed to support Customs and Border Protection. Esper was also with Trump when the president toured an Abrams tank facility in Lima, Ohio in March.
"Mark Esper is a highly respected gentleman with a great career. Westpoint, Harvard, a tremendous talent," Trump told reporters on Tuesday afternoon, adding, "I think he will do very well. He was secretary of the Army. I got to know him very well. He's an outstanding guy."
The following Pentagon jobs are now vacant or occupied in an "acting" capacity: defense secretary, deputy defense secretary, Army secretary, Air Force secretary, and chief management officer.
ABC News' Jordyn Phelps contributed to this report.