Unit is a clear example of the evolution of a word from one thing to something completely different. But it also has the rarity of almost making sense. See, when it showed up in the mid sixteenth century, it only meant a number of things regarded as an undivided group, i.e. a herd of sheep would be a unit, but the individual animals would not be. From there it evolved to a single part of a greater whole in the seventeenth century—so at that time, a member of the herd would be a unit—and then finally, it became a standard of measure in the eighteenth century. So it went from a whole, to a part, to a quantity of measure. Okay, I take back the part about it making sense.
Unit of course is related to unity, which showed up way earlier in the early fourteenth century. It comes from the Anglo-French unite and Old French…unite, descended from the classical Latin unitatem, sameness or agreement. And it shouldn’t surprise anyone that unitatem comes from unus, the Latin word for one. For the record, yes, unite also comes from this family (duh!). It showed up in the early fifteenth century from the Latin unire, to unite, and also from unus.
There’s also a totally awesome digression I can (and will) go into: see, union is obviously related to unit, right? Well, it just so happens that in Late Latin it’s unionem, which is also a way to say, and I quote, “a single pearl or onion”. There are layers to an onion, but the whole is a unit, as it were, so unionem became a colloquialism for “a type of onion”. And that was kept in Old French, Anglo-French, and in English to the point where it became the official version of the word in both English and French (oignion).
TL;DR: ONION. IS. FROM. UNION.
That is entirely more awesome than it has any right to be.