It's mostly already been said, but okay.
Stirrups give extra stability in the saddle. As already mentioned, they help a cowboy stay in place when roping a cow or a knight stay on top when fighting another knight.
In the modern forward seat, stirrups are used to allow the rider to lift off the horse's back. This helps the horse have more freedom of movement when going flat out (hence why jockeys balance in the stirrups) or jumping. A really skilled and FIT rider CAN do two point/forward seat without stirrups, and most train to, but they're extremely helpful.
Stirrups also help the rider's comfort on long rides. And they can help you stay on in a tight spot such as if your horse decides to abruptly maneuver sideways because there's a horse eating monster under the tarp that's been in that corner of the arena for six months...
But they are not absolutely necessary just for staying on and riding a horse, just kind of useful.