The common fig is a member of the genus Ficus. Ficus is a large genus with some 2000 tropical and subtropical tree, shrub and vine species distributed around the whole world. The fruit of all ficus species is the syconium, an enlarged, fleshy and hollow peduncle bearing closely massed tiny flowers on its inner wall. The true fruits are tiny drupelets which develop from these flowers. The problem is these flowers are borne on the inside of the syconium. They never open to the outside world like respectable roses, cabbages and oak trees. How do they get pollinated?
That's their weird sex life. Hold on for this is complicated. F. carica and some closely related species come in two basic forms: edible figs and caprifigs. Caprifigs are the host of the fig pollinator Blastophages psenes or fig wasp which lays its eggs in the caprifig's short-styled female flowers. The male fig wasp grows, mates and dies inside the caprifig fruit in which he is born. The female is more adventuresome. She leaves the caprifig fruit through its ostiole or eye (picking up a lot of pollen in the process) and flies off in search of a new fruit at the right stage of development in which to lay her eggs.
The kicker is this: female fig wasps lay so many eggs in each caprifig fruit that very few, if any, of the female flowers ever produce seeds. Not good for ficus species survival. Evolution (or God, if you prefer) provided a solution: the edible fig. The plant and fruit look just like those of the caprifig, but have two important differences: no male flowers and the female flowers have long styles which prevent the fig wasp from laying her eggs. If she enters the fruit of an edible fig, she searches desperately for, but finds no suitable female flowers. As she does, she scatters the pollen she picked up leaving the caprifig. And, this pollenizes (or caprifies) the edible fig. When caprified, each fruit will produce several hundred to several thousand seeds per fruit, depending on the variety. Not so great for the individual fig wasp, but good for the ficus species. Overall, the situation benefits both figs and fig wasps. There are plenty of caprifigs to nourish the fig wasps and plenty of edible figs to produce fig seeds which develop into fig and caprifig plants.