Mr Trump launched a fresh attack on Mr Khan by claiming the capital is not safe under the Mayor.
Quoting a tweet from right-wing commentator Katie Hopkins which said officers have "lost control of London streets" and "lost control of their twitter account too", Mr Trump wrote: "With the incompetent Mayor of London, you will never have safe streets!"
The retweets were removed from Trump's twitter page swiftly. The President’s tweets came hours after the Met’s Twitter account was targeted by hackers who posted a series of bizarre tweets from the force’s official account.
With the incompetent Mayor of London, you will never have safe streets! https://t.co/pJqL1NjyvA— Donald J. Trump (@realDonaldTrump)July 20, 2019
Late on Friday night, a number of tweets were sent from the force's Twitter account, which has more than 1.22 million followers, calling for the release of drill rap artist Digga D.
One post, which has since been deleted, read: "We aim to make London the safest global city; Be the best crime-fighters, by any measure; Earn the trust and confidence of every community; Take pride in the quality of our service; So people love, respect and are proud of London's Met."
Another said: "FREE DIGGA D ON FOENEM GANG."
Scotland Yard said in a statement there had been no "hack" of its IT infrastructure and the security issue had only affected its MyNewsDesk account, which it uses to issue news releases.
"Last night, Friday 19 July, unauthorised messages appeared on the news section of our website as well as on the @metpoliceuk Twitter feed and in emails sent to subscribers.
"While we are still working to establish exactly what happened, we have begun making changes to our access arrangements to MyNewsDesk," it said.
Earlier, a Scotland Yard superintendent had said the Met's official account has "been subject to unauthorised access".
Superintendent Roy Smith tweeted: "Our media team are working hard to delete the messages and ensure the security of the account. Please ignore any Tweets until we verify that it is back under official control."