Inherited from Vulgar Latin *ad poenam, with an additional adverbial /-s/ (compare doncs < Latin tunc).
a penes