Hack is short for the word hackney, which word was first recorded around 1300–50; It appeared as the Middle English hakeney - ie a form of the placename Hackney, in Middlesex. This was, one must assume, a place associated with the hiring out of carts and drivers for personal transportation around the growing conurbation of London. Hence Hackney Cabs - which taxis are stlll officially known as today - and hackney ponies and horses, now of course a very specialised breed and no longer used for their original purpose!
The process of word change, assimilation and cultural changes resulted eventually in the 'hack' being first of all a horse let out for hire, but which was not a horse for a specific purpose such as a hunter, cart-horse etc, and then the word became a synonym for the sort of activity which was done on such a horse, and the abbreviated noun 'hack' became accepted as the verb 'to hack'.
No doubt a good dictionary of etymology would tell you much more, as would a good reference book about the development of carriages and horse-drawn transportation.