There is some uncertainty about the origin of yard.
It is known to be descended from the Anglo-Saxon gierd of which there are related forms in the Teutonic languages generally, and it has been suggested that the ultimate origin may be either the Latin hasta, “spear,” or the Russian zherd’, “a thin pole.”
Either, though, is relatively long and slender and could as easily have led to the nautical yard, the relatively long and slender spar that is hung upon and crosswise to the mast of a ship to support a square sail.
As is so for other such crossed configurations, either part of the cross-member is one of its arms, hence, yardarm, “one of the arms of a yard.”