We usually hear that set theory is a foundation for contemporary mathematics. Category theory is also another foundation of maths. There are other theories which deemed to be a foundation for maths.
Question 1: What does it mean to say a particular theory is a foundation of contemporary maths, "precisely"?
Question 2: In some cases people say, set theory is a foundation for almost all parts of modern mathematics. Why almost not all? Is there any mathematical concept or field that is not known to be expressible in terms of set theoretic axioms?
Question 3: Is it possible that a particular theory be a foundation of contemporary maths but not a foundation for mathematics in future? If yes, how is it possible?
Question 4: Is it meaningful to compare two foundations of maths and conclude that one of them is better, more useful or more fundamental than the other? If yes, how? and what can we say about the case of set theory and category theory?
There is probably not one definition of "foundation" that everybody will agree on. However, there is an answer to the question why set theory lies at the foundation of all of mathematics:
Set theory is an extension of propositional logic, the framework of strict reasoning implicitly underlying everything mathematicians do. Let $P$ and $Q$ be propositions, and let $A$ and $B$ be the sets of entities for which propositions $P$ and $Q$ hold. One can now put all boolean operations on $P,Q$ in direct correspondence with set operations on $A,B$, for example
$$P∨ Q\quad\leftrightarrow\quad A∪B$$
$$P∧ Q\quad\leftrightarrow\quad A∩B$$
$$¬ P\quad\leftrightarrow\quad \overline A$$
etc.
The key advantage of the set-theoretic formulation of logic is that its elements (sets) can be objects that are of mathematical interest anyway, such as numbers. Thus set theory blurs the distinction between object of study and method of study and provides a natural foundation for such branches of mathematics as algebra, probability theory and topology.