Yes, some figs will contain wasp eggs/larvae/pupae, depending on the time of the year and where you live. The adults do not stay in the fig though. But unless you’re blind or distracted while eating, you’ll notice if something is wrong – the fig will be thinner and, well, there are animals inside it. If they’re your own figs from your own tree, you can always pay attention to see if there’s an abundance of wasp carcasses at the base of the tree – males die as soon as they leave the fig, so that means your tree is “infected”.
Technically, the fig that you eat is not a fruit, it’s a flower field surrounded by a fleshy covering. Only the female fig wasp can open a special hole on it, which she does to lay her eggs inside. The eggs hatch, and larvae will feed off the fleshy covering. When they grow to the adult stage, they break out, taking all the pollen they collected from the flowers inside the fig with them. Males will have already inseminated the females, so the females fly off to another fig, pollinating it while laying her eggs.