No, the slang term for a prostitute “hooker” did not originate with soldiers serving under the Civil War general Joseph Hooker.
The term was already in use in 1845, two decades before the Civil War.
A more reasonable origin for the term comes from Webster’s New World Dictionary, which says that a hooker was “originally a resident of Corlear’s Hook, an area in New York City, whose brothels were frequented by sailors.”