For the same reason Jesus was baptized by John, though he had no sins to repent. Mary fulfilled the Law.
According to Leviticus 12:2-8, a mother was purified forty days after the birth of a son, and she was required to offer a lamb as a burnt offering and a young pigeon or turtledove as a sin offering. A poor woman could substitute another pigeon or turtledove for the lamb, thus offering two of them.
The purification had to do with ritual uncleanliness and didn't imply a moral fault in childbirth. As Jesus would later, Mary fulfilled all the precepts of the Law, which, clearly, wasn't written to make allowances for a sinless man (the Messiah) or his sinless mother.