This article is from the alt.usage.english FAQ, by Mark Israel email@example.com with numerous contributions by others.
This phrase formerly meant "by fair means or foul", although now
it often (especially in the U.K.) means simply "by whatever
necessary means". The first recorded use is by John Wycliffe in
"Controversial Tracts" (circa 1380). Theories include: a law or
custom in mediaeval England that allowed peasants to take as
firewood from the King's forests any deadwood that they could reach
with a shepherd's crook and cut off with a reaper's billhook;
rhyming words for "direct" (reachable with a long hook) and
"indirect" (roundabout); beginners' writing exercises, where letters
have hooks and brackets are "crooks"; and from "Hook" and "Crook",
the names of headlands on either side of a bay north of Waterford,
Ireland, referring to a captain's determination to make the haven of
the bay in bad weather using one headland or the other as a guide.