This answer reflects my personal opinion, or rather results from my personal studies.
I can see two main purposes.
Salvation of the sinner
The first purpose is to help the person that is being disciplined. This is apparent from Paul's writing to the Corinthians:
1 Cor 5:4-5 (ESV)
4 When you are assembled in the name of the Lord Jesus and my spirit is present, with the power of our Lord Jesus,
5 you are to deliver this man to Satan for the destruction of the flesh, so that his spirit may be saved in the day of the Lord.
It's difficult to say what this exactly means, but clearly the goal is that his spirit may be saved. In general, there can be multiple different ways that discipline helps a person turn from the road to destruction.
Purity of the church
Christ wants His bride pure.
Col 1:21-22 (ESV)
21 And you, who once were alienated and hostile in mind, doing evil deeds, 22 he has now reconciled in his body of flesh by his death, in order to present you holy and blameless and above reproach before him
Continuing from the earlier passage, Paul writes:
1 Cor 5:6-8 (ESV)
6 Your boasting is not good. Do you not know that a little leaven leavens the whole lump? 7 Cleanse out the old leaven that you may be a new lump, as you really are unleavened. For Christ, our Passover lamb, has been sacrificed. 8 Let us therefore celebrate the festival, not with the old leaven, the leaven of malice and evil, but with the unleavened bread of sincerity and truth.
Little leaven leavens the whole lump. Similarly, one person living in sin lures others in the community to live in sin, making the whole community impure.
As for the relation between the two, church discipline should always be part of God's discipline. It should always happen in the guidance of God and according to principles set in the bible (implementation details). Anything other would be spiritual violence. God thankfully has a lot of other means to discipline His children, so church discipline is just one detail of a big picture.