Ovipositor

An ovipositor is the long hollow tube on the rear of female insects (and some other animals). Through this tube they lay eggs. The ovipositor is formed by the union of three pairs of rear appendages. 
In many species it is a piercing organ which allows the insect to put its eggs into a specific place. In some species of wasp, the female drills through tree bark with her ovipositor and lays eggs in the bodies of grubs eating under the bark. 
However, in many hymenoptera the ovipositor is used as a sting, and the female does not use it for egg-laying.