In the context of discussing how halakha deals with actions that will lead to a person being responsible on two different levels – e.g. he will deserve both a death penalty and to pay as a consequence of what he did, our Gemara quotes a Mishna from Massekhet Ḥullin (14a) which teaches that a person who performs shehitah (ritual slaughter) of an animal on Shabbat or on Yom Kippur will receive the death penalty; nonetheless his shehitah will be considered good – the animal will be deemed kosher and can be eaten.
Although this ruling is presented as a straightforward halakha, the rishonim are disturbed by the fact that we ordinarily deem a Shabbat transgressor as a meshumad – an apostate – whose shehitah should be considered invalid!
Tosafot in Ḥullin argue that not every violation of Shabbat will give a person the status of a meshumad. In fact, only someone who willfully violates the Sabbath in a public manner would be put into that category. Apparently in our case the shehitah was done privately. Another suggestion raised by Tosafot is that hillul would cause us to consider the transgressor a meshumad only after the act was done. Thus, the forbidden shehitah on would be considered valid, even as it would create a situation where any subsequent shehitah done by this individual would not be accepted.
In his commentary to the Mishna in Ḥullin, the Rambam takes a different approach, arguing that the person in this case performing the shehitah on Shabbat must have done so be-shogeg – by accident, i.e. he was unaware that it was Shabbat, or was not knowledgeable in the rules of Shabbat to know that shehitah was forbidden. It is clear that someone who accidentally transgresses the rules of Shabbat is not considered an apostate. Were he to have purposefully done shehitah on Shabbat, however, the meat would not be considered kosher.