This is the genealogy of Jesus the Messiah the son of David, the son of Abraham:
Abraham was the father of Isaac,
Jesus was descended of a long line of people going back to mythical times, many of whose existence can't be verified by an archeological record, just like every other human being who has ever lived. Jesus was descended from people who lived in a strange land and suffered through Interesting Times and had silly names, just as all people are. Jesus was the child of a long line of ancestors whose obscure names are downright boring to read aloud in a list, just as we are. Jesus is God Who became Human, and humans are like that.
Sarah the wife of Abraham is not named. Leah with the lovely eyes isn't here. The women mentioned in this genealogy are all women who did something scandalous, or had something scandalous done to them. Matthew mentions them, before telling how the birth of Jesus came about.
The first woman is Tamar, who gave birth to Judah's sons, Perez and Zerah. Tamar was married to Judah's oldest son, Er, who was wicked, so Er was cursed to die childless. But Tamar wasn't wicked, and she needed a son. Sons were everything in that culture, in that era. A woman's only security, her only identity, her only chance at having her name live on after death, was having a son. To be widowed AND childless was the greatest disgrace imaginable. So Judah did what his culture required, and gave his daughter-in-law to his second son, Onan. Onan was supposed to father a child on Tamar who would be biologically his, but legally the son of Er and Tamar. Onan did Tamar a dirty trick and pulled out, for which he was cursed to die as well. Shelah, the youngest son of Judah, was too young to father children yet, but Judah promised that he'd give Tamar a son before too long. Tamar waited patiently at her father's house. And when the time came, Judah also played a dirty trick. He did not marry Shelah to Tamar.
Tamar took matters into her own hands. She dressed up like a shrine prostitute, with a veil to cover her face. She waited for her dishonest father-in-law to come town and seduced him. Judah, who followed the Lord and wasn't supposed to have anything to do with shrine prostitutes, fell for it. Tamar did what she had to do. She became pregnant with Perez and Zerah, and Perez became the ancestor of Christ.
The next woman mentioned is Rahab. Rahab was a prostitute or maybe just an innkeeper; she was also a traitor to the city of Jericho, and let Israelite spies hide on her roof. When the men of Jericho came and demanded she turn them over, Rahab lied that they'd gone a different way. She had to do this or she would have been killed in the genocide that was coming. She mentioned to the Israelites how frightened everyone in town was, because of them. Because she hid the spies, she and her family were not murdered when the Israelites put Jericho under the ban. Rahab married a man named Salmon, and became the ancestor of Christ.
The next woman mentioned is Ruth. Ruth was a Moabite. She was a member of a tribe of people the Israelites despised. They were not to marry Moabite women or give their daughters in marriage to Moabite men. But when famine fell on Judah, Maholn found himself living in Moab, and somehow was given Ruth in marriage. Maholn died, leaving Ruth doubly disgraced: she was childless, and the widow of a foreigner. But Ruth was a dutiful woman. She accompanied her mother-in-law, Naomi, back to Judah where she was despised. She gleaned for wheat in the fields until she caught the eye of Boaz. With a little prodding from bossy Naomi, she snuck into Boaz's house and curled up in his bed, after which they had to get married. That was how the two ended up the ancestors of Christ.
The next woman mentioned is "Uriah's wife," who was the mother of David's son, Solomon. That woman's name was Bathsheba. She was the faithful wife of Uriah the Hittite until David spied on her while she took her monthly ritual bath. David had her summoned to his palace, where she had no choice but to go. He got her pregnant- and then, to cover his tracks, he had her husband murdered. She suffered a miscarriage from all the trauma. None of this was Bathsheba's fault. Bathsheba was raped. "Rape" is word for a sex act a king commits on a powerless woman who can't possibly say "no." The prophet Nathan was so disgusted, he compared Bathsheba to an innocent lamb- and David to the thief who stole that lamb and cooked and ate her.
God found a way to honor Bathsheba, who had been the victim of such a shameful act. He made her the ancestor of Christ.
When the Holy Ghost inspired Matthew to write down the genealogy of Jesus, the very first chapter of all the Gospels and the whole New Testament, She inspired Matthew to include four famous women from long ago: not the unproblematic women, but the women whose lives had been made a mess. Four women who were done wrong by men, and sometimes abused by men, and had to do things they shouldn't in order to survive in a world of men.
The fifth woman mentioned in the Gospel According to Matthew is Miriam. Glorious things are said of Miriam, and justly so. Miriam was the most virtuous and the most important person in the whole world. But Matthew centers the story on Joseph. Look at Joseph for a moment.
Joseph's fiancée, Miriam, was a good girl who did nothing wrong. And then, to the surprise of all around her, she got pregnant.
Joseph was not perfect like Miriam, but he was just. He was faithful to the Law, and unwilling to expose Miriam to disgrace. He didn't do anything to harm Miriam or to shame her for apparently breaking her promise and humiliating him as well. He could have, but he didn't. He decided to take care of Miriam by quietly dissolving their marriage agreement, so she could marry the man who knocked her up.
But Miriam wasn't pregnant by a man. Miriam was pregnant by the Holy Spirit.
The Angel of the Lord appeared to Joseph in a dream. They explained that Joseph mustn't be afraid to take Miriam into his home, because the child she bore was special. Joseph didn't have to obey the angel, of course. It was entirely his choice. Doing right or wrong is always a man's choice. Joseph had free will. He could have left Miriam in the lurch like Judah left Tamar, or made Miriam afraid like the Israelites intimidated Rahab and the others in Jericho, or waited until he was embarrassed to do the right thing like Boaz, or done something unspeakable like David. But Joseph chose to obey the angel. He took Miriam into his home, and had no relations with her until she gave birth to the Son of God.
This is the genealogy of Christ: a line of human beings, many of them bad as most humans are, and these four women in particular were marked by scandal that wasn't their fault.
This is how the birth of Jesus came about: Miriam consented to be the Mother of God, at the same time consenting to the risk of a dangerous scandal. Joseph, being male in a world of men, could have chosen to be as terrible as some of his ancestors. Instead, he chose justly, and obeyed the prompting of an angel, and protected Miriam without demanding sex. Because of this, he was honored to become the foster father of God's own Son.
Through this, we have become the sons and daughters of God, and not just of terrible human beings.