Ah, but the prologue doesn't spoil the ending of Romeo and Juliet! Take a look at those lines again:
From forth the fatal loins of these two foes
A pair of star-cross’d lovers take their life;
Whose misadventur’d piteous overthrows
Doth with their death bury their parents’ strife.
So these "star-cross'd" lovers will die to bury their parents' strife. Many of <PERSON>'s tragedies end with the main characters dying, so it's likely that the audience already knew that the main characters would likely die, and the prologue might be slyly hinting that they will "take their [own] life" (although that line clearly means "take their lives [from forth the fatal loins ...]", thanks @DLosc!), but doesn't tell you anything about why this death comes about. The audience knows something sad is coming, but they don't know what it will be yet.
In my opinion, this prologue sets you up to think that the suicide will be engineered by the lovers, perhaps of the "if we can't be together, life isn't worth it" variety. As you watch the play, however, things seems to get better and better for <PERSON> and <PERSON> while things get worse and worse for the <PERSON> and the <PERSON>: they meet! They fall in love! They get married! A cunning plan is hatched so that <PERSON> can run away from her family and be reunited with her husband! All this time, the audience is thinking, "Wait a minute, this is a tragedy? And the prologue told me that they're going to kill themselves? How will we get there from here?"
And then, boom, a letter goes awry, <PERSON> decides to kill himself and, just like that, the audience knows where this is going. 674
Without the prologue, they would spend Act 5 wondering if <PERSON>'s plan can be stopped; with it, they are certain that his plan will succeed. This lends additional tragedy to the scenes of <PERSON> planning his death and Friar <PERSON> learning that <PERSON> doesn't know about the scheme, since the audience already knows that these schemes will fail, that <PERSON> will die, and that this will almost certainly lead to <PERSON>'s own death. I'd argue that, without the prologue, Act 5 could have been longer, with more potential interruptions to <PERSON>'s plan -- and further increasing the audience's hopefulness -- before a surprising finish. But <PERSON> opted to let the audience get ahead of the story, giving them a longer period of time to feel sad for the characters before their actions destroy their own lives.
This makes this more like the end of <PERSON> (where <PERSON>'s ghost tells the non-history-buffs <PERSON>' final fate, who then has time to reconcile himself to it), rather than the end of Othello (where <PERSON>'s plan succeeds right to the end, when it is unexpectedly revealed and some small sense of justice is restored). It's also a bit like an episode of TV where the teaser shows you, say, a street covered with the debris from an explosion, and the audience then spends the rest of the show trying to work out how that happened. 190