Play is all about exercise and learning. Part of it is simply about increasing strength and coordination. A lot of it is about learning valuable physical skills like stalking, fighting, chasing, catching etc. And a lot of it is about learning non physical skills. For instance a lot of young animals (including humans) can be hugely annoying in their persistence to do mischief because it teaches them about social boundaries.
Young animals go too far in their play because they only learn about social boundaries when an adult puts them in their place. Along the same lines, they learn about appropriate consequences by watching adults mete out discipline and watching adults interact with other adults. Ie. causing mischief is punished by a slap or a scolding but not by a maiming bite. When an adult faces another adult in a territorial dispute it’s preferable to threaten before resorting to violence.
And finally play teaches young animals about their personal limitations. They’ll teach it to climb fearlessly because it knows what it can and can’t do. It’ll know how fast it can run, how far it can jump and so on. It’ll help them learn that their abilities increase as they grow because they run faster and jump farther than they could last week during the same game.
Play tends to be unique to animals whose abilities change and grow with them. You won’t see much play among insects, arachnids and most reptiles for instance. They’re born fully capable (even though practice and learning can improve their capabilities).