We know there are four whorls in a flower, one of them is the carpel which represents the female reproductive part of the flower.
The ovary, stigma and style are all parts of the carpel i.e. they are a part of the female reproductive part of the flower.
Ovary is the reproductive component that includes quite a lot of ovules.
The number of ovaries varies from one flower to another, it basically depends upon the number of carpels.
Such as, in the case of a monocarpellary flower we have one carpel and one ovary whereas in the case of a bicarpellary flower there are 2 carpels and two ovaries.