The fact that entropy is a state function is what renders it path-independent. You could regard path independence as the defining property of a state function. Entropy is a state function because it depends only on the arrangement (as a statistical average) of the constituents of the system at the given values of the thermodynamic variables (T,P,V etc), not how the arrangement was obtained.
Since the entropy is a state variable, the difference in entropy must also be constant for two specific states. Since the change only depends on the states of the end points, if you find some way of determining the entropy difference, say by performing a transformation in a particular special way, then that difference must be the same for all possible processes that take you between the two states.
The rather remarkable thing is that there is a special (and ideal) way of transforming one system into another that will provide the magnitude of the entropy change for any transformation, and that is to sum the ratio of the heat produced to the temperature at each of infinitely many infinitely small steps of a reversible path, one performed infinitely slowly: $$\Delta S = \int_1^2 \frac{dq_{rev}}{T}$$
Although this is presented as the definition of the entropy (according to one formulation of the 2nd law), it is a thermodynamic definition and can lead one to miss the forest for the trees. The entropy is a property of the system, not of the path. That the above relation between heat, T, and entropy exists is remarkable (and has other implications, for instance wrt the definition of heat and T), but it is essential to remember that in general entropy is a property of the states, not of the path.
There are a lot of other posts on this site worth consulting for more on similar questions.