The verse comes toward the end of a section concerning the work of the church on behalf of a member in sin. After going privately to a brother or sister who has sinned, and the confrontation has been unsuccessful, one must take another along, and then as a last resort, tell it to the whole church.
Jesus is proclaiming his presence in the midst of a body of believers. It will be important for the disciples after Jesus ascends to function as a plurality, particularly in matters of church discipline. Christ promises to be present with them whenever they are gathered in his name. And while the prayer in question mostly concerns the matter at hand of restoration of the repentant, or exclusion of the unrepentant, the principle can be applied wider. If Christians gather in the name of Christ and are united in their prayer of faith according to the will of God, then it will be done by the Father.
Breaking Down the Key Parts of Matthew 18:19
Jesus is probably considering what He is saying here as a restatement of the previous verse, “Whatever you bind on earth will be bound in heaven, and whatever you loose on earth will be loosed in heaven.” Jesus is declaring the gathered church to have the power of his presence.
#2 “truly I tell you that if two of you on earth…”
After the emphasis of “truly I tell you,” Jesus states that the number required for the constitution of a gathered church can be very small. In the gathered church, no matter how small, Jesus promises his presence.
#3 “…agree about anything they ask for,”
There is great power in the unified prayers of God’s people. The agreement can be a sign of God’s blessing and will. This is one reason why churches are to be led by a true plurality of elders.
#4 “it will be done for them by my Father in Heaven.”
The assumption here is that all the requirements are met. Because of the union of vision between the members, it is assumed that Christ has been present and made God’s will known. The will of God is prayed out by the gathering with faith and in Jesus’ name. This prayer will be answered.