As others have said, there really isn't any single answer for your question. Depending upon the type of service (public vs private), type of contract (if 911/emergency), insurance requirements, and even DOT requirements for what's considered safe/unsafe can all play into the length of time a given ambulance might remain in service with a particular entity and in a particular role.
A few years ago, a private company that contracted to do 911 EMS was required by the terms of the contract to provide ambulances in a sufficient number to do the service, that those ambulances couldn't be more than 5 years old or have more than 100,000 miles. Once an ambulance in the 911 service reached either of those points, it was to be pulled from 911 service. It usually then was repainted and sent to work in the company's BLS and ALS interfacility service. It would remain in that service until it became uneconomical to keep on the road. Often those things would end up with more than 400,000 miles and more than 10 years old before they were sent on... to a third-world country where they'd then sometimes return to emergency service and run until (quite literally) something fell off or broke (that couldn't be fixed) that was necessary to keep the thing moving. Municipal services tend to turn over their equipment more frequently so those might end up being sold at auction with (relatively) few miles on them and then be pressed into service for another 10 years or more.
I once drove an ambulance that was (at the time) about 20 years old. Pretty much everything still worked well, so it was still in service. The engine was tired and cranky but once you got it started, it'd run all day long. The next oldest ambulances were about 10 years old... and they still worked just fine. Most of what I drove back then were between 3 and 5 years old, purchased at muni auctions so... they were all still pretty "young" and reasonably cheap.
So, if you look around for answers, you'll find plenty of them and they're all going to be valid for the service those ambulances do. Private 911 ambulances tend to be newer but will be pretty beat up by the time they're ready to be retired. Private non-911 ambulances tend to be a little older and really beat up at the end of their lives. Municipal ambulances tend to be relatively new, are usually still under warranty, and usually aren't driven that hard. These are generalities so this stuff isn't going to be true all the time with all services.
Just look at your current fleet's age, maintenance status (down time for maintenance/repairs) and so on... that'll give you some idea what your service needs to look at for criteria to retire old ambulances.