We're not allowed to strike anyone who doesn't deserve it, neither an innocent person nor a person sentenced to lashes who has been given the requisite amount.
Striking someone (outside of the context of court-ordered whiplashes) is considered evil. In Exodus 2:13, Moshe asks "the wicked one," "Why will you strike your friend?'" The Talmud in Sanhedrin (58b) points out that the person is called wicked just for raising his hand, even though he has not yet delivered a blow.
Regarding one who has been sentenced to lashes by the court, the Torah says, "if the wicked one deserves lashes" (Deut. 25:2), followed by the command not to give him extra lashes because if we do, "your brother will be degraded" (25:3). The Sifre, quoted by Rashi on 25:3, demonstrates that before the punishment is administered, he is still considered "wicked." After he has paid his penalty, he is once again called "your brother" and it is forbidden to strike him. (The fact that the Torah has us administer 39 lashes instead of 40 is a built-in safeguard against accidentally going over.)
The reason for this mitzvah is that it is simply not right to hit another person. The only context in which it is acceptable is when administering lashes as a punishment on the part of beis din.
The general prohibition against striking another person is in effect at all times and in all places. The specific prohibition against not administering extra lashes only applies when there is a court empowered to administer lashes in the first place. This mitzvah is discussed in the Talmud in the tractates of Sanhedrin (58b) and Kesubos (32a-b). It is codified in the Mishneh Torah in the sixteenth chapter of Hilchos Sanhedrin. This mitzvah is #300 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #43 of the 194 negative mitzvos that can be observed today as listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar.