From The Aquarium Wiki
Odontodes, or dermal teeth, are hard bony thorns found on the external surfaces of animals (such as the frontal ray of pectoral, ventral or adipose fins of fish) or near internal openings. They are comprised of a soft pulp surrounded by dentine and covered by a mineralized substance such as enamel. In some animals (notably catfish) the presence or size of odontodes can be used in determining the sex.
When the fish is threatened it will lock these fins into an open position and therefore makes the fish look bigger and these thorns can help wedge the fish tight into crevices and cracks. If the fish is eaten, the odontodes will ensure that the predator can't swallow the fish easily as its throat lining will be damaged.