To finish work for the day. Alternatively, to work quickly and complete a task - similar to polish off. A third alternative is a slang term meaning to steal.
The origin of the first meaning could possibly be from the habit of knocking a special beat to indicate a change of oarsmen in slave galleys. That's speculation but several of the earliest references to the term come from a nautical source; for example, William Clark Russell's novel An ocean tragedy, 1890:
"We were forced to knock off through sheer fatigue."
The second meaning - to work quickly and complete a task is known by the early 19th century; for example, Thomas Love Peacock's novel Melincourt, 1817:
"He had to dispose of a christening, a marriage, and a funeral; but he would knock them off as fast as he could."
The third, 'stealing' meaning originated about a century later. That's recorded in The Athenaeum, August 1919:
"A curious term used by a Tommy [British soldier] , in 'explaining' his deficiencies of kit, is 'Someone knocked it off' for 'Someone pinched (or made away with) it'."