The CONTEXT of that passage must be established before a correct understanding can be obtained.

Thus., the context is broadly a teaching concerning how Christians individually and the Church corporately are to deal with offenses/sins; whether real or presumed. Jesus moves along from a one-to-one situation where the offender and offended meet and either come to an understanding of their situation and either make amends or disagree on a solution. Next, the offended party brings two or three 'witnesses' who if possible meet with the offending party (again whether rightly or wrongly accused) and they converse hearing both sides, etc. IF the witnesses are in accord with the offended party that his grievance is legitimate and the offender refuses to acknowledge the sin, repent and ask forgiveness, then those witnesses along with the original offended party are to report the situation and their attempts to gain reconciliation to the "Church", i.e., the Elders of the assembly and by them the whole congregation as a whole (asking for prayer in their dealing with the matter). After the Elders have done all that they can and/or think wise to gain satisfaction through either exoneration or a finding of guiltiness of the offender who refuses to repent, they make a proper judgment of action accordingly.
Thus, if the finding is 'innocency' in regard to the accused action/words/etc.. i.e., they in accordance with the Law of God, thus "loose" that individual. That decision is thus recognized "in heaven". If, on the other hand, they find that the accused is found guilty of sin and stands unrepentant then their decision to "bind" him/her through disciplinary action and even excommunication is likewise recognized in heaven.
1. This authority and power to rule on such matters by the Elders is designated to them by God through the working of the Spirit, first calling those men to the ministry of the church and then residing in their minds and hearts supplying the wisdom to carry out their responsibilities, discipline being one of many.
2. Does this loosing and binding which is recorded in heaven mean that every decision made is infallible? Certainly not. For all men are fallible and prone to err in such matters. But regardless of whether their loosing or binding is right and according to God's revealed will, their action is always known of God and will eventually mean reward or punishment for them.
NOTE: William Hendriksen in his excellent commentary on the Gospel of Matthew gives a worthwhile explanation of the text and his wise understanding of it.

My explanation above is my own and I believe it to be in substantial agreement with men such as Calvin, many Puritans and the historic Reformed churches.