Bathsheba

Bible says that King David had many wives and sons - These are the sons of David who were born to him in Hebron: the firstborn, Amnon, by Ahinoam the Jezreelite; the second, Daniel, by Abigail the Carmelite, the third, Absalom, whose mother was Maacah, the daughter of Talmai, king of Geshur; the fourth, Adonijah, whose mother was Haggith; the fifth, Shephatiah, by Abital; the sixth, Ithream, by his wife Eglah; six were born to him in Hebron, where he reigned for seven years and six months. And he reigned thirty-three years in Jerusalem. These were born to him in Jerusalem: Shimea, Shobab, Nathan and Solomon, four by Bath-shua, the daughter of Ammiel; then Ibhar, Elishama, Eliphelet, Nogah, Nepheg, Japhia, Elishama, Eliada, and Eliphelet, nine. All these were David's sons, besides the sons of the concubines, and Tamar was their sister - 1 Chronicles 3:1-9

But God has chosen both "Solomon for paternal line" and "Nathen for maternal line" from Bathsheba for his only begotten son to come into this world, what could be the reason?

When King David had external marital affairs with Bathsheba, prophet Nathan is the one who exposed David's secret sin and condemned him - Nathan said to David, “You are the man! Thus says the Lord, the God of Israel, ‘I anointed you king over Israel, and I delivered you out of the hand of Saul. And I gave you your master's house and your master's wives into your arms and gave you the house of Israel and of Judah. And if this were too little, I would add to you as much more. Why have you despised the word of the Lord, to do what is evil in his sight? You have struck down Uriah the Hittite with the sword and have taken his wife to be your wife and have killed him with the sword of the Ammonites. Now therefore the sword shall never depart from your house, because you have despised me and have taken the wife of Uriah the Hittite to be your wife - 2 Samuel 12:7-10

David and Bathsheba would have done what King Herod and Herodias had done to John the Baptist - For Herod had seized John and bound him and put him in prison for the sake of Herodias, his brother Philip's wife, because John had been saying to him, “It is not lawful for you to have her.” - Matthew 14:3-4

But David and Bathsheba demonstrated the work of Holy Spirit in their life, and called one of their sons as Nathan as an acts of respect to prophet Nathan, and God remembered Bathsheba's act, and chosen Nathan for his paternal line - Let the righteous strike me; It shall be a kindness. And let him rebuke me; It shall be as excellent oil; Let my head not refuse it - Psalm 141:5a