Slavery is an impediment to receiving the sacrament of Holy Orders.
1917 Code* canon 987 §4 (cf. 1983 Code canon 1042):
The [following] are simply impeded [from receiving Holy Orders]:
4.° Those who are strictly speaking slaves before receiving liberty;
[Latin original: "Servi servitute proprie dicta ante acceptam libertatem"]
Canonist Dom Charles Augustine commentates on this canon (A Commentary on the New Code of Canon Law bk. 2, vol. 4, p. 499):
4.° Slaves, properly so-called, before they are given their liberty. This belongs to the same defectus libertatis ["lack of freedom"]. Regarding slaves in the proper sense, i.e., men who belong bodily to a master, the Church ordained that they should not enter the clerical state, partly because their admission would lower its dignity, and partly because they were not their own masters.
This defectus libertatis is also the reason why a married man cannot become a priest without the consent of his wife. Cf. Dom Augustine's commentary p. 498 on 1917 Code canon 987 §2 ("Men having wives [are impeded from receiving Holy Orders];").
Cf. also 2 Tim. 2:4:
No man, being a soldier to God, entangleth himself with secular businesses; that he may please him to whom he hath engaged himself.
St. Thomas Aquinas addressed the question of "Whether the state of slavery is an impediment to receiving Orders?" (c. 1256 A.D.) in his Summa Theologica suppl. q. 39 a. 3 (= Super Sent. lib. 4 d. 25 q. 2 a. 2), a commentary on Lombard's Sentences. St. Thomas answers:
By receiving Orders a man pledges himself to the Divine offices. And since no man can give what is not his, a slave who has not the disposal of himself, cannot be raised to Orders. If, however, he be raised, he receives the Order, because freedom is not required for the validity of the sacrament, although it is requisite for its lawfulness, since it hinders not the power, but the act only. The same reason applies to all who are under an obligation to others, such as those who are in debt and like persons.
*The 1917 Code was a codification/organization of laws most of which existed before, either as unwritten law (ius) or written law (lex) such as from Gratian's Decretals.