From the verb to stick (to fasten, make firm, fix).
The fixed capital of a farm. Stock in trade.
The village stocks,
in which the feet are stuck or fastened. A gun stock,
which the gun is stuck or made fast.
It is on the stocks.
It is in hand, but not yet finished. The stocks is the frame in
which a ship is placed while building, and so long as it is in hand it
is said to be or to lie on the stocks.
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894