Joachim and Anne were the parents of Mary and grandparents of Jesus. Joachim was from Nazareth in Galilee and Anne was from Bethlehem. They were childless and God opened the womb of Anne in her old age to give an extraordinary child as it happened to Sarah, wife of Abraham in Genesis.
According to the tradition, when Joachim and Anne were childless, they promised God if they could have a child, they would entrust that child to the Temple for the service of the Lord. That was a custom of the time. So, they offered Mary, at three, in the Temple, keeping their promise.
While Mary grew up in the temple, her aged parents died. A girl could not continue in the Temple from her puberty. So, between the age of 12 and 14, the Temple authorities betrothed her to Joseph, who was divinely selected to marry her. Joseph, originally from Bethlehem, had moved to Nazareth for a job because he was a construction worker. Joseph took Mary from Jerusalem to Nazareth.
Though Joachim and Anne felt disappointed at first because they had no child, when they got one at their old age, she was the most blessed among women and God’s choice to become the mother of the Messiah. Thus, Joachim and Anne became grandparents of Jesus Christ. Let us not get disappointed when we feel unfortunate in life with our limited knowledge. God can have a better plan for us, provided we remain faithful to Him as the parents of Mary did.