The important thing to understand is that fulfilling these 4 axioms is all there is to being a group-in mathematics, we construct objects by imposing conditions on them and the underlying aggregates. (I'm not using the term "set" since mathematics doesn't always deal with sets,but you get the idea.) What allows us to build a theory around a particuar defined object is the fact that whatever we choose the properties to be,those properties must be consistent with each other. It's the consequences of those properties cooexisting consistently that gives any object it's distinctive properties spelled out in the body of theorums and corollaries. And that's the answer to your question: It turns out if you don't have associativity-that is, if axiom (2) is false, then axiom (4) is false because then you can have a set which has left inverses which are not right inverses and the definition assumes the inverse ( as well as the identity) is 2 sided. Consider an element x of a group G where there is a unique identity e and a left inverse l and a right inverse r for x. Then by axiom (4),they must be equal since both yield the unique identity and every inverse must be 2 sided. But:
l = l*e = 1*( x*r) = (1*x)*r = e*r= r.
But clearly the fact of l= r is dependent on the associativity of the operation. So whatever this algebraic structure is,it's not a group without it.
Hope that answered your question.