Used since the 18th century to describe a ship.
'Ship' is a pretty homogenous term
these days, but
back then, to describe a vessel as a 'true' ship, it had to have 3 masts (fore, main, and mizzen) and on each of these were 3 sails (main, top, and topgallant) suspended from
horizontal 'yards'. To handle so many sails, a fairly large crew is required. Warships carried much, much larger crews than merchantmen, and so it was only warships and the large, prestigeous merchant ships such as East Indiamen that could be described as having 'the whole (or full) nine yards'.