In this passage, Paul explains why believers cannot live a life of sin, although they are not under law, but under grace.
The first reason is found in verse 16, in which Paul says that living a life of sin means that the one who is doing that is a slave of sin. On the other hand, one who practices righteousness is a slave of righteousness. Therefore, one is either a slave of sin, or a slave of righteousness. In light of these realities, Paul teaches his readers that they committed to obeying God, and thus were freed from sin. As a result, they became slaves of righteousness. Because they became slaves of righteousness, it is impossible for them to live a life of sin.
Therefore, Paul commands his readers to present their bodies as slaves of righteousness, which he promises will increase their holiness. Then, he presents another reason for which believers are slaves of righteousness: when they were slaves of sin, they were free from righteousness. Therefore, he implies, with a rhetorical question, that they were not benefiting from being enslaved to sin.
Next, he explains how they benefit from being enslaved to righteousness: they are enslaved to God, and therefore, benefit from righteousness, which leads to further holiness. The end result of it all is eternal life. Paul ends by giving the reason for which being free from sin and enslaved to God leads to eternal life: sinning earns death, but eternal life is a gift in Christ.