"The practice started at a time when player compensation, even those at top professional clubs, was at a level that made it difficult to maintain it as a primary form of employment therefore retirement savings might not exist. These matches are generally well-attended and the gesture by the club can give the honoree income that enables a retirement income base or enable the honoree an opportunity to establish themselves in other employment when they finished playing. This is still the main objective of testimonials in Australia, Ireland and some other countries.
Clubs typically grant testimonials to players upon reaching ten years of service with a club, although in recent years they have been given to players for particular circumstances such as approaching retirement. Typically, the club invites (depending on the career of the honoree) current or retired teammates (typically the honoree's club and national team) to participate in the match or with the associated festivities. All proceeds from the match go to the player which depending on the applicable country laws may be tax-free. These matches have become less frequent as changes have occurred in football that make the original purpose less needed or appreciated. Wages have increased, players may not stay with a club as long as they had formerly and those top players that have the esteem of the public and in the past had financial need for such assistance make it less likely for the public support the purpose of these matches.[2][3] However, testimonial matches for players who have given many years of service to the club (i.e. one-club men) and are popular with fans and have a higher turnout."
Used to be a thing in football, not so much now though.