The algebra of quaternions is simply defined by the relations that $i^2 = j^2 = k^2 = -1$, with $ij = -ji$ (and similar relations about the product of any two of the $i,j,k$). So, in a potentially unsatisfying way, we know that $ij = -ji$ when we're talking quaternions simply because that's what the definition tells us.
Here's an analogy. In school, before you had learned that there's a (complex) number $i$ so that $i^2 = -1$, you were probably told "Squaring any number always gives us a positive number, since positive $\times$ positive is positive, and negative $\times$ negative is positive".
So, it wouldn't be surprising if you had some serious objections to hearing about this mysterious new number $i$ whose square is negative! Perhaps in the past your teacher had said "Squaring any number always gives us a positive number", or perhaps they told you the full story and said "Squaring any real number always gives us a positive number," but before seeing complex numbers (like $i$) that word 'real' was probably inconsequential: You only knew of real numbers, so you (at best) tuned that caveat out!
So, when you learned in school that "multiplication is commutative", what you really learned was that "multiplication of complex numbers is commutative" (which includes multiplying integers, rational numbers, and real numbers too). In this new, larger number system (the quaternions), it's not necessarily true that multiplication is commutative.
Note that lots of things aren't commutative. A big example is the composition of functions, which includes linear transformations (like rotations). So, this just might just be the first non-commutative algebraic structure whose objects look like familiar numbers that you've encountered. But you have encountered situations where "order matters" before, almost certainly. This is one of those cases.
This question is of the same nature.
– Aloizio Macedo Jul 26 '15 at 20:25