Afaik shingle roofs (common in US) need replacing every 10-20 years.
Composition roofs need to be replaced when they are worn out and not before that. Good materials competently installed could last 50 years, more in mild climates. If you have the kind of weather that will wear down a roof in 10 years you probably cannot have solar panels.