Asimov fulfilled Machiavelli's description of a futurist: "Whoever wishes to foresee the future must consult the past; for human events ever resemble those of preceding times." The Foundation Trilogy is not prophecy. Asimov consulted the rise and the fall of the Roman Empire to create his sci-fi world.
But mapping out an entire Galactic Empire using the Roman Empire as a base wasn't meant for a lazy analogy. Asimov, I believe, was testing out his hypothesis: if civilizational decline follows predictable patterns, can we engineer our way out?
Hari Seldon is one of the main protagonists. He is a mathematician who invented a statistical framework called Psychohistory. Psychohistory would analyze the past patterns and predict the future (on a grander scale, not on an individual level). He finds that the Galactic Empire is doomed to collapse, with eventual chaos followed for 30 thousand years.
The Foundation is especially compelling right now. We are living through our own version of late-empire decline. We have institutions that no longer solve problems. Bureaucracies that exist to perpetuate themselves. Systems running on momentum rather than purpose. And too many standards that make the point of "standard" pointless. Like Rome's grain dole, we have programs designed to manage problems rather than get rid of them. (I talked about this in one of the essays in the writing section: Exit).
Asimov says the Foundation is the solution. We need to preserve knowledge for better times, so we can go through chaotic times faster. Akin to a prescription written way before the illness kicks in. The right prescription helps alleviate the pain and keeps the immune system at stable levels while the body deals with the problem.
The collapse is inevitable. But we can prepare for it. We can build the Foundation that survives the fall.