In the wild, female wasps pollinate figs while attempting to lay their eggs inside of the fig, but sadly the female often dies inside of the fig. Don’t worry, figs have a powerful enzyme that can easily break down the wasp long before they are ripened and eaten.
Propagated figs like the ones you buy in supermarkets do not use wasps to pollinate the figs, instead using a hormone spray that allows the fig to ripen without pollination.