Did Mary have any children other than Jesus? If so, how can she be the eternal virgin?
Mary had four other sons, Joseph, James, Jude, and Simon. Because of the virgin birth, Joseph was not the father of Jesus so these were the half brothers of Jesus. The last three mentioned are not to be confused with those who were disciples of Jesus by the same name. Here are some passages where the other sons of Mary by Joseph are mentioned (Matt. 12:46; 13:55; Mark 6:3; John 2:12; 7:3, 5, 10; Acts 1:14; 1 Cor. 9:5; Gal. 1:19).
The Catholic doctrine of the eternal virginity of Mary is not supported by the Scripture. They claim these others were sons of Joseph by a former wife, but there is no biblical foundation for this nor for the perpetual virginity of Mary. The Bible only teaches us that Joseph kept her a virgin until after the birth of Jesus (see Matt. 1:18-25 below).
1:18 Now the birth of Jesus Christ happened this way. While his mother Mary was engaged to Joseph, but before they came together, she was found to be pregnant through the Holy Spirit. 1:19 Because Joseph, her husband to be, was a righteous man, and because he did not want to disgrace her, he intended to divorce her privately. 1:20 When he had contemplated about this, an angel of the Lord appeared to him in a dream and said, “Joseph, son of David, do not be afraid to take Mary as your wife, because the child conceived in her is from the Holy Spirit. 1:21 She will give birth to a son and you will name him Jesus, because he will save his people from their sins.” 1:22 This all happened so that what was spoken by the Lord through the prophet would be fulfilled: 1:23 “Look! The virgin will conceive and bear a son, and they will call him Emmanuel,” which means “God with us.” 1:24 When Joseph awoke from sleep he did what the angel of the Lord told him. He took his wife, 1:25 but did not have marital relations with her until she gave birth to a son, whom he called Jesus. (note the words in verse 25 which I have put in bold italics to point you to the answer to part of your questions. The other words in bold italics are because they are a quote from Isa. 7:14).