I think the short answer is, they didn't, it just seems like it because of odd editing. See my update at the end for why.
In practice, there's no way they could have done what appears to have happened in the movie. However, the movie makes a few token attempts to explain the trip, likely trying to gloss over the problem.
The first open question is that they never say where Themyscira actually is. The bulk of the evidence would put it somewhere in the Aegean Sea and/or eastern part of the Mediterranean Sea. From there, a sailboat voyage to London in ideal conditions would take several weeks. If you moved Themyscira out into the Atlantic you could cut the time down significantly, but that causes other problems with Steve Trevor's airplane escape from Turkey.
The movie also isn't explicitly clear about how long they were on the boat. The way the scene transitions happen, it's strongly implied that it happened over night. The movie fades out soon after leaving Themyscira as Steve and Diana go to sleep, then fades back in with Diana waking up in the Thames. But it's possible (I'd say likely) they were at sea for a few days, at least, and the film just skipped over the boring parts in the middle.
Lastly, Steve explicitly points out that they "hitched a ride" part of the way to London. The implication is that they found a steam-powered boat to pull them part of the way to London, which shortened the trip a lot. Of course, this still means they could only have met the boat sometime after Diana went to sleep the previous night, or she'd have known, so at best they covered the last half-day of their trip under steam power. A WW I era steam vessel could probably make the whole trip in a few days, and most of that is the Mediterranean, so it's probably not unreasonable to think they met a British ship soon after they hit the Atlantic and were towed the rest of the way.
Having watched the movie again a few times, I'm now convinced that the director didn't intend for the trip to be done in a single day, but the way the scene is edited is confusing.
Diana takes Steve to the docks shortly after sundown and they sail out into the sea. Some time later, they have a conversation then go to sleep. The scene cuts to Ludendorff arriving at his new base of operations, at dawn, to restart Dr. Maru's work.. The scene then cuts back to Steve and Diana, sometime early-to-mid-morning, arriving in London having "hitched a ride".
I don't remember if the movie specifically pinpoints where the second base is, but I get the impression it was in German territory as opposed to Ottoman territory, which Ludendorff would have needed to travel to by car or train (given that it was a war zone, likely not an easy trip). It also appears that Maru had been at work for some time when he arrived (and since losing her notebook), and Ludendorff also seemed to have recently learned information about the Armistice that was causing him to hurry. The entire scene on Themyscira appears to have taken place the same day that Steve Trevor blew up the first base of operations, where we last saw Ludendorff and Maru, so all of those things must have happened after that.
All of these imply that there was a significant time jump between the first boat scene and the Ludendorff scene, but the movie just skipped over it. There was probably another time jump when going back to Diana and Steve in the boat, again skipped over for brevity.
The most likely answer, then, is that they didn't sail to London in one night while sleeping, it was just a boring trip that the director chose not to show it.