Originally Luther believed that confession to a priest was a holy sacrament. After being what he called 'born again', which is often referred to as his Tower Experience, he began to see confession and penance differently.
Early in the reformation he still maintained that it was still a sacrament, along with Baptism and the Lord's Supper, but the priests involvement was almost meaningless in his explanation, as they were there as mere mouth pieces to declare the gospel of forgiveness, which 'any child' could just as easily do considering the fact it is only reminding sinners of the gospel.
Here he argues that it does not really matter who you confess to:
A pope or bishop does nothing more than the lowliest priest. Indeed where there is no priest, each individual Christian—even a woman or child—does as much. For any Christian can say to you, “God forgives you your sins, in the name,” etc., and if you can accept that word with a confident faith, as though God were saying it to you, then in that same faith you are surely absolved.
It follows that the keys or the authority of St. Peter is not an authority at all but a service; and the keys have not been given to St. Peter but to you and me. The keys are yours and mine. (Luther's Works Vol 35.16)
Yet luther had many suspicions and detestations of the way many people used this practice not truthfully acting as a mere mouthpiece but to torment the consciences of those who foolishly sought the help of blind priests. . To Luther they were trying to make it a matter of works, as opposed to the free gospel which the priest should merely affirm:
A number of people have been teaching us that we should, and must necessarily, be uncertain about absolution, and doubt whether we have been restored to grace and our sins forgiven—on the grounds that we do not know whether our contrition has been adequate or whether sufficient satisfaction has been made for our sins. And because this is not known, the priest cannot at once assign appropriate penance. Be on guard against these misleading and un-Christian gossips. The priest is necessarily uncertain as to your contrition and faith, but this is not what matters. To him it is enough that you make confession and seek an absolution. He is supposed to give it to you and is obligated to do so. What will come of it, however, he should leave to God and to your faith. You should not be debating in the first place whether or not your contrition is sufficient. Rather you should be assured of this, that after all your efforts your contrition is not sufficient. This is why you must cast yourself upon the grace of God, hear his sufficiently sure word in the sacrament, accept it in free and joyful faith, and never doubt that you have come to grace—not by your own merits or contrition but by his gracious and divine mercy, which promises, offers, and grants you full and free forgiveness of sins in order that in the face of all the assaults of sin, conscience, and the devil, you thus learn to glory and trust not in yourself or your own actions, but in the grace and mercy of your dear Father in heaven. (Luther's Works Vol 35.15)
After some more thought, as some years passed, his detestations became clearer to him, not only did he no longer consider it a sacrament but fully made known his thoughts about the Papal abuse of it. In an Exhortation of Martin Luther to All the Clergy Assembled at Augsburg for the Diet of 1530 he made his final sentiments known about the confessional, confessions and penance. As is usual in the world of Luther the practices of the church seemed to have become so horribly perverse but we do not have much history to work from other than to take his word for it as a former monk and teacher.
My dear man, was not this, too, a blasphemous trade fair, invented in every respect for the sake of money? As if God had not before through the gospel given all such things freely to all the world, or as if God had forbidden these things, and they were the mighty men who could sell the commandments of God for money. The gospel must be nothing and God must be their merchandise. (Luther's Works Vol 34.19)
I consider one of the greatest plagues on earth whereby you have confused the conscience of the whole world, caused so many souls to despair, and have weakened and quenched all men’s faith in Christ.
(Luther's Works Vol 34.19).
That is the very worst and hell itself! If one were to forgive and remit all abominations, one can never forgive you for this one. This doctrine has filled hell and has troubled the kingdom of Christ more horribly than the Turk or the whole world could ever do. For you taught us that we should by our own works make satisfaction for sin, even against God. And that was called repenting of sin. You have nowhere given so much emphasis to contrition and confession, although you have made works of them also. Now what else does it mean to say, “You must make satisfaction for your sins,” than to say, “You must deny Christ, renounce your baptism, blaspheme the gospel, reproach God for lies, disbelieve the forgiveness of sins, tread underfoot Christ’s blood and death, dishonor the Holy Spirit, and go to heaven by your own effort with such virtues”? Alas, where are the tongues and voices which can say enough about this? (Luther's Works Vol 34.20)