Mathematics is models reality, so, if reality changes, mathematics must change.
According to Kant, Mathematics raises as a priori knowledge, not directly from experience (there are no numbers in nature), but indirectly (we create the concept of object, unity, multiplicity, number, etc. in order to address natural phenomena). That is, we can't know spheres per se, we just internally create the concept of sphere in order to know, for example, apples. All logic and mathematics are just part of metaphysics (we can't use the scientific method to prove logic and mathematical facts, because any method and any part of science already depend on logic and mathematics; both are a priori for science).
So, all mathematical objects, like lines, spheres, numbers, etc. are just abstractions of real facts. Evidently, there are mathematical ideas that don't correspond trivially to real objects, like spheres might be understood as an abstraction of apples: they are just inferential mathematical results.
Of course, if the laws of nature change, mathematics would be different. For example, if there would be no objects (e.g. the alternative universe would be something like a foam), numbers wouldn't be necessary anymore. But the entities that live inside would develop new concepts to describe the foam-universe, for example, vector-like elements, with which they would perform other types of mathematical operations. And they would never know what a number is.