For the crime of raping Goewin and killing lots of Math's men, including the Demetian king, Pryderi, Math magically transforms his two nephews into three animals over the space of three years. In this form the two brothers mate and produce offspring, one per year. Note how this is described in this ancient Welsh legend:
Then he took his magic wand, and struck Gilvaethwy, so that he became a deer, and he seized upon the other hastily lest he should escape from him. And he struck him with the same magic wand, and he became a deer also. "Since now ye are in bonds, I will that ye go forth together and be companions, and possess the nature of the animals whose form ye bear. And this day twelvemonth come hither unto me."
This form of punishment by Math suggests that there is a certain justice about the form of this punishment. Gwydion and his brother, Gilvaethwy, have shown themselves to be beastly and animal-like in terms of their inability to control their passions and desires. All Math does through this punishment is to give them the form that their internal characters suggest. In addition, the rather bizarre transformation of his nephews into male and female forms of the same animal in a sense is a form of sexual abuse that is the equivalent of the rape of Goewin. There is, therefore, a sense in which the punishment of Gwydion is poetic justice as it seems to match the crimes that were committed.