Donatism was the error taught by Donatus, bishop of Casae Nigrae, that the effectiveness of the sacraments depends on the moral character of the minister. In other words, if a minister who was involved in a serious enough sin were to baptize a person, that baptism would be considered invalid.
Donatism developed as a result of the persecution of Christians ordered by Diocletian in 303 in which all churches and sacred Scriptures of the Christians were to be destroyed. In 304 another edict was issued ordering the burning of incense to the idol gods of the Roman empire. Of course, Christians refused, but it did not curtail the increased persecution. Many Christians gave up the sacred texts to the persecutors and even betrayed other Christians to the Romans. These people became known as "traditors," Christians who betrayed other Christians. (Note: traditor, not traitor).
At the consecration of bishop Caecilian of Carthage in 311, one of the three bishops, Felix, bishop of Aptunga, who consecrated Caecilian, had given copies of the Bible to the Roman persecutors. A group of about 70 bishops formed a synod and declared the consecration of the bishop to be invalid. Great debate arose concerning the validity of the sacraments (baptism, the Lord's Supper, etc.,) by one who had sinned so greatly against other Christians.
Ater the death of Caecilian, Aelius Donatus the Great became bishop of Carthage, and it is from his name that the movement is called. The Donatists were gaining "converts" to their cause, and a division was arising in the Catholic church. They began to practice rebaptism which was particularly troublesome to the church at the time and was condemned at the Synod of Arles in 314 since it basically said the authority in the Catholic church was lost.
The Donatist issue was raised at several ecumenical councils and finally submitted to Emperor Constantine in 316. In each case the consecration of bishop Caecilian was upheld. However, persecution fuels emotions, and by 350 the Donatists had gained many converts and outnumbered the Orthodox in Africa. But it was the apologetic by Augustine that turned the tide against the Donatist movement which eventually died out in the next century.
The problem with Donatism is that no person is morally pure. The effectiveness of the baptism or administration of the Lord's supper does not cease to be effective if the moral character of the minister is in question or even demonstrated to be faulty. Rather, the sacraments are powerful because of what they are--visible representations of spiritual realities. God is the one who works in and through them, and He is not restricted by the moral state of the administrant.