The verse is part of the previous passage about church discipline:
(Matthew 18:15-18 NIV) "If your brother sins against you, go and show him his fault, just between the two of you. If he listens to you, you have won your brother over. {16} But if he will not listen, take one or two others along, so that 'every matter may be established by the testimony of two or three witnesses.' {17} If he refuses to listen to them, tell it to the church; and if he refuses to listen even to the church, treat him as you would a pagan or a tax collector. {18} "I tell you the truth, whatever you bind on earth will be bound in heaven, and whatever you loose on earth will be loosed in heaven.
RE: Matthew 18:18