The word 'harbor' (British English 'harbour') descends from Middle English 'herberwe' or 'herbour' (lodging, shelter, a protected place), from Old English 'herebeorg' (lodging, quarters), from Proto-Germanic *harjabergō, a compound of *harjaz (army, host, war band) and *bergō (shelter, protection, that which hides or covers). At its etymological core, a harbor is a place where an army takes shelter.
The first element, *harjaz (army), is the source of numerous personal names and place names across the Germanic world: 'Harry,' 'Harold,' 'Herbert' (bright army), 'Herman' (army man). It also produced Old English 'here' (army), which survives in 'Hereford' (army ford) and 'heriot' (a feudal death tax, originally the return of military equipment). The second element, *bergō (shelter), is related to the verb *berganą (to shelter, to save, to hide), which produced German 'bergen' (to rescue, to salvage) and survives in English place names like 'Canterbury' (the stronghold of the people of Kent).
The semantic development from 'army shelter' to 'any shelter or lodging' was complete by the Old English period. The further narrowing to 'a sheltered place for ships' developed during the Middle English period, as England's maritime identity grew and the need for a specific word for a ship's haven intensified. The broader sense of 'shelter' or 'lodging' faded from common use but left traces: the verb 'to harbor' (to give shelter to, to conceal — as in 'harboring a fugitive' or 'harboring resentment') preserves the original, non-nautical meaning.
The related word 'harbinger' has an equally unexpected history. A 'harbinger' was originally a 'herbergere' — a person sent ahead of a traveling army, royal court, or noble party to arrange lodgings. The harbinger's job was to secure the harbor (shelter) before the main group arrived. Over time, the word detached from its specific duty and came to mean anyone or anything that goes ahead and signals what is to come: a harbinger of spring, a harbinger of doom. The inserted 'n' in 'harbinger' is the same phonological intrusion that produced 'messenger' from 'message' and 'passenger' from 'passage.'
The Germanic compound *harjabergō was borrowed into Old French as 'herberge' (lodging, inn), which later became modern French 'auberge' (inn, small hotel) and 'héberger' (to lodge, to accommodate). This means that a French 'auberge' in Provence and the American naval base 'Pearl Harbor' in Hawaii descend from the same Proto-Germanic compound — one through French adaptation, the other through direct English inheritance.
The cognates in other Germanic languages have largely retained the 'lodging' meaning rather than the maritime one: German 'Herberge' (inn, hostel), Dutch 'herberg' (inn), Swedish 'härbärge' (hostel, shelter), Danish 'herberge' (hostel). Only English made the full transition to a primarily nautical term. This divergence reflects England's island geography and the outsized role of seafaring in English cultural and economic life.