Why did Mary and Joseph have to offer two turtledoves in Luke 2:22-24 as a sin offering when there was no sin commited?
First, let’s look at the verses in question:
And when the time came for their purification according to the law of Moses, they brought him up to Jerusalem to present him to the Lord (as it is written in the law of the Lord, “Every male that opens the womb shall be called holy to the Lord”) and to offer a sacrifice according to what is said in the law of the Lord, “a pair of turtledoves, or two young pigeons” (Luke 2:22-24).
Just as Jesus would later submit himself to John’s baptism of repentance (cf. Mark 1:4, 9-10) even though he committed no sin, so Mary offered the sin offering in obedience to the law of Moses although she had not personally committed sin.
In Jesus’ case, his baptism was, among other things, an example of obedience and a model for the sacramental baptism that he would later institute (cf. John 3:3-5). Mary’s purification was also an example of obedience to the Mosaic law, which was still in effect at the time of her purification.
The Purification of Mary by St. Thomas Aquinas