Could other planets in the solar system previously have been habitable planets such as Earth but eventually like all things died out and ceased to be viable? Could this account for the many barren planets?
The idea that planets age and go from being viable to dead is an old one (and typical for old science fiction), but not really supported by modern science.
Rather, both planets and the sun evolve over time. The sun is slowly getting brighter and this moves the habitable zone where liquid water can exist outwards. This interacts with the kind of atmosphere different planets have, which in turn depends on their geology and magnetic field.
Venus may have had oceans early on, but after a few hundred million to several billion years the growing solar luminosity led to the buildup of water vapor in the atmosphere acting as a greenhouse gas, causing a runaway greenhouse turning it uninhabitable.
Mars also may have been somewhat habitable, maybe even with oceans, but it was always rather cold. Since it is small, the dynamo currents inside its core ceased early and that led to the loss of the magnetic field, that in turn led to erosion of the atmosphere and hydrosphere due to solar wind and UV radiation .
Meanwhile Mercury was never habitable, nor the outer worlds since they are beyond the frostline (although there might be subsurface oceans on Europa, Enceladus and other places that are fairly independent of the sun).
As the sun luminosity increases when it becomes a red giant in a few billion years that definitely ends the habitability of Earth (although current prognosis is that the biosphere is likely to end long before this, due to CO$_2$ depletion and runaway greenhouse effects). That will produce brief periods when Mars, the moons of Jupiter and maybe even the moons of Saturn are in the habitable zone - however, this period is very brief, not much time for life to emerge or even the geology to stabilize. After that, they become cold again as the sun turns into a white dwarf.
Things do not necessarily age like biological organisms. Here much of the changes are driven by an outside force, the sun, rather than internal changes.
Most modern science generally agrees that it's not impossible for Mars to have once had microbial life, whether on its surface or underground. It's why so many probes, orbiters, landers, and rovers have been sent to Mars.
Europa, Enceladus, and other such "ice moons" likely have subsurface oceans and may have life in them.
However, no actual, conclusive, unarguable evidence of such life has been found yet. So, as of right now, the answer is "maybe", with a corollary of "it sure wouldn't look like Earth, though".