According to this myth, there were so many p rostitutes working around Union General Joseph Hooker's army that they became known as "Hooker's Division" or "Hooker's Brigade" or simply "hookers." The New Partridge Dictionary of Slang calls this story "popular fiction."
The fly in the ointment is that the term was in use before the Civil War. According to the Oxford English Dictionary, this word had its origins as early as 1567 when it meant petty thief or pickpocket. (Other definitions include a person who fastened his clothing with hooks, like the Amish, a two-masted Dutch finishing vessel, and a rugby player, but we'll ignore those.)
In America this synonym for p rostitute dates back at least as far as 1845. It probably evolved from the conventional sense of hook, to lure and take or rob, qualities associated with p rostitutes. John Bartlett's Dictionary of Americanisms of 1859 defines a hooker as a strumpet and says it comes from the New York neighborhood known as Corlear's Hook, where there were lots of p rostitutes. That's probably another myth.
Since "hooker" already meant p rostitute by the time of the Civil War, it was an obvious joke to refer to the p rostitutes around General Hooker's army as Hooker's Brigade.
(An interesting aside: in French, the man who solicits patrons to come to a whorehouse is known as an accrocheur, or hooker, from the verb accrocher, to hook.)