The reason you had never heard it before is because there isn't one shred of evidence–not one–to support this idea. The book you were reading is fiction–and that's exactly what this idea is: fiction.
Nowhere in the Bible (or in any other Christian writing after Jesus' ministry) is there any hint at all that Jesus was married. For example, His closest relatives and disciples came together at the cross as He was dying–but no wife is mentioned, as she would have been if He had been married. Jesus' sole concern then was for the welfare of His mother (see John 19:26-27).
This isn't to say that Jesus disapproved of marriage–not at all. In fact, His first miracle took place at a wedding, to which He had been invited with His mother and some of His disciples (see John 2:1-11). God gave marriage to us, and Jesus spoke often about the joys and responsibilities of marriage. Most of the earliest disciples were married, including Peter (whose mother-in-law was healed by Jesus–Mark 1:30).
Jesus came into the world for one reason: to die for our sins on the cross. Don't be misled by myths that might turn you away from that great truth. Instead, make sure of your commitment to Him, for "He himself bore our sins in his body on the tree (cross), so that we might die to sins and live for righteousness" (1 Peter 2:24).