How many times have I prayed this in a worship service: "Lord, You said, 'Where two or more are gathered in My name, I am present with them.' We recognize, therefore, that You are here with us" But the context of these verses is not worship. The subject of the entire chapter is offense, forgiveness, and reconciliation. Jesus is not necessarily saying that He is present with us when we gather with a group of people to sing hymns and hear preaching. He is promising His presence with us in the gritty work of restoration. Much talk of being offended is just sour grapes--it is an excuse for not going hunting with my uncle because he lied about shooting my deer! This is not about perceived offenses. In this case two three reliable witnesses have verified that the transgression is real. (This is a key point: getting validation that the wrongdoing is real and not just my selfish imagination). Jesus promised His presence with us when we go to the offender with witnesses in a attempt, not to condemn, but to reconcile. Anyone who has been there knows that this is sensitive work. You might discover, in the presence of witnesses, that you made a mistake! There is always that possibility. But regardless, confronting someone with their sin is always a super-touchy matter. We don't need to be doing this on our own! We need the Lord with us. We need the Lord to break through crusty hearts and hard feelings. Only through Jesus is genuine reconciliation possible. Could be that the specific matter Jesus tells us to pray for in verse 19 is restoration? After all, that is the reason why He came to earth in the first place... and the heart of everything He said in Matthew 18!
By the way, notice that of the three times Jesus mentioned the word "church," two are in verse 17. Oh, how often people have a tendency to get sideways with each other in church! When sheep rub up against each other they get irritated! This is why one of our main jobs is to keep the fellowship free of the poison of unforgiveness and bitterness.