The 1841 British edition omitted the a before punishment. The a was restored to the LDS text in the 1879 edition. The a is expected given the contrastive parallelism in this sentence between “a law” and “a punishment”. Subsequent verses in this chapter show the same conjoining of “a law” and “a punishment”:
Summary: Maintain the indefinite article a before punishment in Alma 42:17 and elsewhere in this chapter.