General life expectancy of a solar panel is 25-30 years. If they get damaged though (cracked glass), that will let water get into the cells and that will drastically reduce life expectancy. But otherwise, a nice long life. They'll also keep operating beyond that lifespan, however the cells do degrade and produce less power.
Where it gets interesting though is that the cost of solar keeps decreasing and the cells themselves become more efficient. I have some used solar panels that are 78" x 39" and produce 265W. I got 10 of them for $600 shipped (technically $400 for the panels and $200 for the shipping). So used, I'm about 23 cents/watt shipped; 15cents/watt basic. But obviously no warranty and these are less efficient. You can get a used 380W panel that fits in the same space, but around 59cents/watt. In a few years, those 380W panels will be even cheaper, and I could theoretically add an additional KW of power on the same footprint on my roof.
New panels will run about $2-$4/watt. Each generation of solar tends to be more efficient, packing more wattage into less space, and each generation often leads to some place deciding to replace or upgrade their 10-20yr old panels, which then end up on the used market benefitting people like me.