"Verily I say unto you, Whatsoever ye shall bind on earth shall be bound in heaven: and whatsoever ye shall loose on earth shall be loosed in heaven. Again I say unto you, That if two of you shall agree on earth as touching any thing that they shall ask, it shall be done for them of my Father which is in heaven."
Verses 18 and 19 have been taken many different ways, but taken in context, they are specifically referring to church discipline. Some might think that church discipline is only symbolic and isn't taken seriously, Jesus is making it clear that in the spiritual realm, discipline that is directed by the Holy Spirit has much power.
The scriptural commands concerning church discipline are to help restore the brother or sister who is in sin just as much as they are to protect other members of the body from that sin. If the person being disciplined repents, it has been achieved and no further action is necessary. Church discipline is to withdraw both our fellowship and our intercession.
Proper intercession can actually keep Satan "away" even though an individual is living in great sin. This is good if the person uses this freedom to repent and come back to God. But, if the person takes this freedom from the wages of sin to commit more sin, there comes a time when this form of intercession ceases to be helpful. In that case, intercession should be stopped, and we should actually retain that person's sins unto him so that he can no longer get by without experiencing the death that sin brings (Romans 6:23). As he starts reaping what he has sown, it, hopefully, will cause him to turn back to the goodness of God.
This is the binding and loosing being referred to in this verse. Heaven and earth are affected by our binding and loosing.