As mentioned by others, ultimately it has to do with the history of the laws. As
@ChasObserverRefDeveloper states, some of the early laws, before the Football Association was formed, called for the use of a string.
However, when the first set of FA laws were promulgated in 1863, they said the following:
"the goals shall be defined by two upright posts, 8 yards apart,
without a tape or bar across them. ... A goal shall be won when the ball passes between the goal posts or over the space between the goal posts (at whatever height)."
Three years later though, in1866 this was changed to:
"the goals shall be upright posts, eight yards apart,
with a tape across them, eight feet from the ground." [...] "A goal shall be won when the ball passes between the goal posts under the tape ..."
A couple more changes got us to more or less where we are now. In 1875, "or bar" was added after "tape" then in 1883, "bar or tape" was replaced with "bar" only
However, see below.
History, I think. That has been in the Laws since at least the 70s. I’d imagine it came in as a safety rule after something happened where someone had the genius idea to keep playing with a broken frame by tying a rope to make the crossbar.
Well actually, as
@Scotty Ref says, using a rope to replace a broken bar (although only in friendly matches) was specifically allowed until 1996.
The allowance for a rope in friendly matches was dropped in 1997.
So I think the reason the law still says a rope is not a permissible replacement for the bar is because strings, tapes or ropes were used, not only back in the early years of the game but also up until relatively recently (in friendly matches at least).