I think most people believe that mathematical truths are logically necessary. The fact that $\sqrt{2}$ is irrational doesn't depend on who proved it, when they proved it, whether they liked it, or any other contingent historical facts.
However, which mathematical structures and theorems we choose to investigate, build other mathematical structures on, and use in formulating physical theories, could be historically contingent. For example, here are some ways that one could argue mathematics might have turned out differently.
The so-called "foundational crisis" in the early 20th century might have been "won" by a different side. For instance, if intuitionism/constructivism had been victorious, modern-day mathematics might be use constructive logic rather than classical logic by default.
A more rigorous justification of infinitesimal numbers, along the lines of non-standard analysis, might have been noticed earlier. In this case, it might have had a chance of becoming the "usual" foundations of calculus and analysis in place of Cauchy's $\epsilon$-$\delta$.
Joel David Hamkins has argued that one possible version of "early infinitesimals" could also have led to the continuum hypothesis being accepted as a fundamental axiom of set theory.
In any of these cases one can argue about how likely such an alternate history is, but at least one can imagine it happening (for instance, in a science fiction story).
What are some other ways in which it's possible to imagine that mathematics might have turned out differently?
I'm not interested in "cosmetic" differences such as the widespread use of base 10 numerals or the notation "$=$" for equality. I'm also not really interested in tweaks to the structure of definitions, like whether a "ring" has a multiplicative identity or whether a "manifold" has a boundary, unless they can be argued to go along with some more significant difference -- I'm interested in differences in which mathematical objects are studied, not in what we call them.
Edit: I am not interested in hypothetical mathematics, e.g. "if X currently-open problem had been solved long ago, then ...". I'm only interested in mathematics that we know now is true and correct, but which might have ended up playing a different role in the culture of mathematics for contingent historical reasons. See my examples: we know now that constructive mathematics is meaningful and that non-standard analysis is rigorous. I'm also not interested in hypotheticals about how the nature of mathematics could be different, e.g. if standards of proof were different.
Edit 2: I'm also not interested in hypothetical non-mathematics, e.g. "if X currently-solved problem hadn't been solved at all, then...". The scenarios I'm interested in are alternate worlds in which more or less all the same truths are known at the present day, but different axioms or formalizations are preferred for historical reasons. If in the real world theorem X was proven before theorem Y, but it could have been the other way around, then mathematics would certainly have looked somewhat different in the interregnum while Y was known but not X; but I would only consider that an answer to the question if you can argue that the inversion of order would cause a lasting effect on mathematics continuing after X was eventually also proven.