The basic phrase would be
Es kommt nicht auf [die Reihenfolge] an,
which as you rightly guessed means that the order doesn't matter, or more literally, that (whatever is talked about) is not dependent on it (es kommt auf X an describes that there is some kind of choice possible with respect to X, on which some situation depends).
Now, both dabei and gar are adverbs modifying this phrase. The gar in general makes the negation stronger, or more total -- "it doesn't depend on the order at all" would be a good literal translation. However, in a case like this, it has more pragmatic function; I would say that could also indicate something like "contrary to what one might expect".
The dabei is a so-called Pronominaladverb. It consists on a demonstrative da "here, there", and the pronoun bei, which on its own means "at", and is used anaphorically, relating to a topic (proabably a mathematical concept) introduced right before. This is not the other meaning of dabei "present", but should be interpreted as something like a relative "concerning this, ..." or perhaps, "for that".
So:
For that, the order doesn't matter at all, and neither does...
We might also say that in combination with the negation, the dabei has an adverserial aspect:
The order doesn't matter at all, though, and neither does...
But in maths, dabei is usually used to add more specific information the topic before, such as
[x >= y wenn P gilt;] dabei ist x = y genau dann, wenn...