1540s, "imaginary motionless straight line around which a body (such as the Earth) rotates," from Latin axis "axle, pivot, axis of the earth or sky," from PIE *aks- "axis" (source also of Old English eax, Old High German ahsa "axle;" Greek axon "axis, axle, wagon;" Sanskrit aksah "an axle, axis, beam of a balance;" Lithuanian ašis "axle").
General sense of "straight line about which parts are arranged" is from 1660s. Figurative sense in world history of "alliance between Germany and Italy" (later extended unetymologically to include Japan) is from 1936. Original reference was to a "Rome-Berlin axis" in central Europe. The word later was used in reference to a London-Washington axis (World War II) and a Moscow-Peking axis (early Cold War).