Using all of one's efforts; at top speed.
'Flat out' as we currently use it, i.e. to suggest maximum effort and speed, is fairly recent. The first record I can find of it in print is from the Manchester newspaper The Daily Dispatch, 1932, which has a mention of "Driving flat out.".
The term had been used earlier though, in the USA. There it was used both as a noun - 'utter failure' and as a verb - 'to fail completely'. These usages date back to the mid 19th century; for example, Caroline M. Kirkland, in New Home, 1839, wrote:
"... the bank would never have 'flatted out' if he had had a finger in the pie."
The two forms of the phrase appear to be entirely unrelated and to have been coined independently. We don't have a clear derivation for either of them. The source of the 'maximum effort' version of the term has been suggested to be various things which are often seen to be flat and could plausibly be related to speed or effort; for example, the legs of racehorses in old paintings, seen at the gallop. Yes, I do know that racehorses don't actually stretch their legs out flat that way when they gallop, but they didn't know that in 1932. Another suggestion, and bear in mind that these are just suggestions and there's no evidence to support them, is that it refers to the spinning regulators of steam engines when running at high speeds. Those are also suggested to be the source of the phrase balls to the wall, with a similar dearth of supporting evidence. Another guess is that it refers to the smoothness of sails on sailing ships when there is a strong wind and they are travelling quickly. None of these suggestions take into account the late emergence of the term though and all relate to practices that were well in decline by the time the phrase was coined. In others words, we don't know the origin.
The Australian expressions - flat out, like a lizard drinking and flat out, like a lizard on a log, are a little easier to interpret. They clearly allude to lying flat on one's face. These are known from around the time of WWII and are recorded in Sidney John Baker's, The drum: Australian character and slang, 1959:
"Ideas of lying flatly (on one's face, not one's back) and of travelling or working at great speed are recorded in the phrases 'flat out like a lizard drinking' and 'flat out like a lizard on a log'."
They are rarely used literally though, i.e. to mean lying flat out, but are just an emphatic form of the usual meaning of 'flat out'.