"You shall redeem every firstborn donkey with a lamb..." (Shemos
It is a mitzvah to redeem a firstborn male donkey for a sheep or its
equivalent before it is thirty days old. The sheep is given to a kohein.
This serves as a reminder of the miracle that Hashem killed all of the
firstborn Egyptians who had tortured us (Sefer HaChinuch, mitzvah 22).
We also remember that donkeys helped us carry our gold and silver when we
left Egypt (Berachos 5b).