Verses 18 and 19 have many applications, but taken in context, they are specifically referring to church discipline. Some might think that church discipline is only symbolic and carries no real weight; however, 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 designed to help restore the brother or sister who is in sin just as much as they are designed to protect other members of the body from that sin. If the person being disciplined repents, the objective has been achieved and no further action should be taken. Church discipline is two-fold. It consists of withdrawing both our fellowship and our intercession.
Proper intercession can actually keep Satan ‘at bay’ 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 beneficial. In that case, intercession against Satan’s attacks should be withdrawn, 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 (Rom. 6:23). As he starts reaping what he has sown, it, hopefully, will cause him to turn back to the goodness of God that he once enjoyed. This is the binding and loosing being referred to in this verse. Heaven and earth are affected by our binding and loosing.