Technically, you can, but you will be facing issues.
Older roofs tend not to be able to be as waterproofed. Also, if you are going to put solar panels on an old roof, your roof is not going to last twenty years if it’s not in great shape.
When you go to replace your roof, you’re going to have to remove all the solar panels and then reinstall them. At the time that you buy your solar, it’s always a great idea to make sure that you’re installing them on a new roof.