Seven is the fourth prime, and the whole of its history follows from an inconvenience: it divides nothing. Not the twelve months, not the 360 degrees, not the sixty minutes, not the twenty-four hours. The seven-day week is the only unit of time in common use that is tied to no astronomical cycle at all, and it has drifted freely against the year for as long as it has existed.
Two things made seven prominent anyway. The first is the moon. The synodic month of 29.53 days falls into four phases of roughly seven and a half days, close enough that quarter-months of seven days appear in Babylonian practice, where the seventh, fourteenth, twenty-first and twenty-eighth of the month were marked as days on which certain activities were avoided.
The second is the seven classical planets: Sun, Moon, Mercury, Venus, Mars, Jupiter and Saturn. That list is not a selection. It is every moving light visible without instruments, and every culture that watched the sky carefully arrived at the same seven. From it come the planetary hours, and from those the names of the weekdays, which is why the sequence across Latin and Germanic languages preserves an astrological ordering rather than any obvious one. From the same source come the seven heavens of Mesopotamian, Jewish and Islamic cosmology and the seven metals of alchemy, each paired with a planet.
The Hebrew Bible's sevens are structural rather than decorative: creation in seven days, the sabbath, the seven-branched menorah, seven years of plenty and seven of famine, seven circuits of Jericho, seven-year cycles of release. The Hebrew word for seven, sheva, shares a root with the verb meaning to swear an oath, which is why Genesis 21 ties seven ewe lambs to the oath sworn at Beersheba, a pun that is doing theological work, not decoration.