The tweet was posted to the company's corporate Twitter account, which has 151,000 followers, just after 6 a.m. and was deleted. McDonald's also has a consumer-facing Twitter account, which has 3.39 million followers.
The tweet called Trump a "disgusting excuse of a President" and said that it wanted former President Barack Obama back in the the White House. It also poked fun at the size of Trump's hands.
"Based on our investigation, we have determined that our Twitter account was hacked by an external source," Terri Hickey, a spokeswoman for McDonald's, told CNBC. "We took swift action to secure it, and we apologize this tweet was sent through our corporate McDonald's account."
The hacking comes just one day after hundreds of Twitter accounts including Justin Bieber's and Forbes were hacked.
While companies like Wendy's and Denny's have been known for their edgy and controversial social media strategies, McDonald's has been more reserved in its posts. The company focuses on promoting its food and business practices.
Trump posted a picture of him eating McDonald's french fries while on his jet on Instagram last year. He also appeared in a commercial for the Golden Arches alongside its character Grimace more than a decade ago.