From The Gospel of Matthew, by Curtis Mitch and Edward Sri, commenting on Matthew 18:15-20
In ancient Judaism, the terms to bind and loose were associated with the authority to teach and to grant or withhold forgiveness of sin. Significantly for this passage, the terms also denoted juridical authority to include or exclude persons from the community of faith.
While this authority was given to Peter uniquely in 16:19, it is now bestowed on the disciples as a whole. In this context, it refers to their authority to make decisions regarding the status of unrepentant sinners in the Christian community. Jesus notes how decisions by his leaders on earth have the authority of heaven behind them.
If two of you agree: Since the context concerns seeking the lost (18:10–14), bringing a sinner to reconciliation (18:15–16), and the Church’s authority to exclude an unrepentant sinner from the community (18:17–18), the united prayer of two disciples here refers particularly to the Lord’s attentiveness to prayers for erring brothers or sisters and for guidance regarding how to care for them. As Nolland observes, “behind the binding and loosing of verse 18 stands the praying of verse 19.”
The juridical theme continues with Jesus’ words about two or three being gathered together in my name. When Christ’s disciples gather to pray, they pray in his name and he is present. In essence, the disciples’ prayer becomes Jesus’ prayer, which will be answered by the Father.
This teaching may reflect a conviction later expressed in rabbinic tradition to the effect that when two Jews sit together to discuss the law, God’s presence abides between them. The disciples, however, gather not around the Torah but in Jesus’ name, and Jesus becomes the new divine presence abiding with them.