Rabbi Yoḥanan said: One who drives a laden animal on Shabbat is exempt from any punishment.
The Gemara explains:
For driving the animal unwittingly, he is not liable to bring a sin-offering because all of the prohibitions in the Torah were juxtaposed to the prohibition of idolatry, from which the principle is derived that one is liable only for actions that he himself performed.
And for driving the animal intentionally, he is also not liable to be executed by stoning, as we learned in the Mishna: One who desecrates Shabbat by performing a matter that for its unwitting performance one is liable to bring a sin-offering, and for its intentional performance one is liable to be executed by stoning. By inference, for a matter that for its unwitting performance one is not liable to bring a sin-offering, for its intentional performance one is not liable to be executed by stoning.
The Gemara argues that an individual who makes an animal work on Shabbat is not even liable to receive lashes:
Even though the Torah explicitly warns against performing labor on Shabbat, it is a prohibition that was fundamentally given, not as a standard prohibition punishable by lashes, but rather as a warning of court-imposed capital punishment, and for any prohibition that was given as a warning of court-imposed capital punishment, if the death penalty is not imposed for any reason, one is not flogged for its violation.
In principle, one who violates a Torah prohibition after being forewarned by witnesses is flogged with forty lashes. However, there are certain categories of prohibitions for which one is not punished with lashes. One such type is called “a prohibition that was given as a warning of court-imposed capital punishment.” In other words, a prohibition whose punishment is explicitly articulated in the Torah as court-imposed capital punishment is excluded from the punishment of lashes. This is patently clear in a case where one is actually sentenced to death. Based on the principle that two punishments are not imposed for one transgression, the one being punished receives the more severe punishment, i.e., execution.
The same principle applies to a case where the death sentence cannot be administered for some reason, e.g., where there was no forewarning. Since this prohibition possesses an element of the death penalty, it is classified as a prohibition that was given as a warning of court-imposed capital punishment, and there is no possibility of punishment by lashes.