This should be understood in the earlier context of the book, in which St. Peter is given the "keys" of the kingdom of heaven, which seem to be entrusted to Peter's authority alone (nay, in this instance, they are given to him alone—just as in John Peter alone is entrusted with Christ's sheep: John 21:15-17), yet seemingly to the Church as a whole ("keys" plural), in the form of the elders (or, bishops) of the Church as a unit, in unison, only seen in Chapter 18 with a specific interpretation or application thereof given by Jesus as He says it.
So earlier in Matthew we read:
Matthew 16:13-20 (NASB) (bold/notes mine)
Now when Jesus came into the district of Caesarea Philippi, He was asking His disciples, “Who do people say that the Son of Man is?” 14 And they said, “Some say John the Baptist; and others, Elijah; but still others, Jeremiah, or one of the prophets.” 15 He said to them, “But who do you say that I am?” 16 Simon Peter answered, “You are the Christ, the Son of the living God.” 17 And Jesus said to him, “Blessed are you, Simon Barjona, because flesh and blood did not reveal this to you, but My Father who is in heaven. 18 “I also say to you that you are Peter [Rock], and upon this rock I will build My church; and the gates of Hades will not overpower it. 19 “I will give you the keys of the kingdom of heaven; and whatever you bind on earth shall have been bound in heaven, and whatever you loose on earth shall have been loosed in heaven.” 20 Then He warned the disciples that they should tell no one that He was the Christ.
Jesus is echoing what was said by God to the 'prime minister' or steward of the Davidic Kingdom, Shebna (concerning Eliakim):
Isaiah 22:21-22 (NASB)
And I will clothe him with your tunic And tie your sash securely about him. I will entrust him with your authority, And he will become a father to the inhabitants of Jerusalem and to the house of Judah. Then I will set the key of the house of David on his shoulder, When he opens no one will shut, When he shuts no one will open.
The Jewish Encyclopedia for 'Binding and Loosing' says the following concerning this authority (footnotes/bold mine):
Rabbinical term for "forbidding and permitting." The expression "asar" (to bind herself by a bond) is used in the Bible (Num. xxx. 3 et seq.) for a vow which prevents one from using a thing. It implies binding an object by a powerful spell in order to prevent its use (see Targ. to Ps. lviii. 6; Shab. 81b, for "magic spell"). The corresponding Aramean "shera" and Hebrew "hittir" (for loosing the prohibitive spell) have no parallel in the Bible.
The power of binding and loosing was always claimed by the Pharisees. Under Queen Alexandra, the Pharisees, says Josephus ("B J." i, 5, § 2), "became the administrators of all public affairs so as to be empowered to banish and readmit whom they pleased, as well as to loose and to bind." This does not mean that, as the learned men, they merely decided what, according to the Law, was forbidden or allowed, but that they possessed and exercised the power of tying or untying a thing by the spell of their divine authority, just as they could, by the power vested in them, pronounce and revoke an anathema upon a person. The various schools had the power "to bind and to loose"; that is, to forbid and to permit (Ḥag. 3b); and they could bind any day by declaring it a fast-day (Meg. Ta'an. xxii.; Ta'an. 12a; Yer. Ned. i. 36c, d). This power and authority, vested in the rabbinical body of each age or in the Sanhedrin (see Authority), received its ratification and final sanction from the celestial court of justice (Sifra, Emor, ix.; Mak. 23b).
In the New Testament.
In this sense Jesus, when appointing his disciples to be his successors, used the familiar formula (Matt. xvi. 19, xviii. 18). By these words he virtually invested them with the same authority as that which he found belonging to the scribes and Pharisees1 who "bind heavy burdens and lay them on men's shoulders, but will not move them with one of their fingers"; that is, "loose them," as they have the power to do (Matt. xxiii. 2-4). In the same sense, in the second epistle of Clement to James II. ("Clementine Homilies," Introduction), Peter is represented as having appointed Clement as his successor, saying: "I communicate to him the power of binding and loosing so that, with respect to everything which he shall ordain in the earth, it shall be decreed in the heavens; for he shall bind what ought to be bound and loose what ought to be loosed as knowing the rule of the church." Quite different from this Judaic and ancient view of the apostolic power of binding and loosing is the one expressed in John xx. 23, where Jesus is represented as having said to his disciples after they had received the Holy Spirit: "Whosesoever sins ye remit, they are remitted unto them; and whosesoever sins ye retain, they are retained." It is this view which, adopted by Tertullian and all the church fathers, invested the head of the Christian Church with the power to forgive sins, the "clavis ordinis," "the key-power of the Church."
1 Matthew 23:2-3
In Chapter 18, we see a specific application of this authority or power to bind and loose, in the form of excommunicatory power of the Apostles in unisonon:
Matthew 18:15-18 (NASB) (bold/notes mine)
“If your brother sins, go and show him his fault in private; if he listens to you, you have won your brother. 16 “But if he does not listen to you, take one or two more with you, so that BY THE MOUTH OF TWO OR THREE WITNESSES EVERY FACT MAY BE CONFIRMED. 17 “If he refuses to listen to them, tell it to the church; and if he refuses to listen even to the church, let him be to you as a Gentile and a tax collector. 18 “Truly I say to you, whatever you [pl.] bind on earth shall have been bound in heaven; and whatever you loose on earth shall have been loosed in heaven.
Specifically citing their power to 'bind and loose' as the foundation for their (the Church) being able to excommunicate (imagine every other person on both sides of a heresy or debate in the Church claiming the authentic, divine authority required to excommunicate—the power would be utterly meaningless and without effect or divine backing, contrary to what is clearly said here).