Rabbi Isaac ben Jacob ha-Kohen wrote in the second half of the 13th century in Spain. His treatise on evil was entitled 'A Treatise on the Left Emanation'. This work introduces Samael and Lilith as husband and wife, a concept which was then incorporated into later Kabbalistic demonology.
Rabbi Isaac states:
'Truly I shall give you a hint, that the reason for all the jealousies which exist between the princes mentioned above, and the [other, good] princes which belong to the seven classes, the classes of the holy angels which are called 'the guardians of the walls,' the reason which evokes hatred and jealousy between the heavenly powers and the powers of the supreme host, is one form which is destined for Samael, and it is Lilith, and it has the image of a feminine form, and Samael is in the form of Adam and Lilith in the form of Eve. Both of them were born in a spiritual birth as one, similar to the form of Adam and Eve, like two pairs of twins, one above and one below. Samael and the Eve the Elder, which is called the Northern one, they are emanated from below the Throne of Glory, and this was caused by the Sin.' - from Chap 6
Rabbi Isaac then explains that when Adam and Eve sinned in the Garden, it caused two sexual awakening among the two pairs of 'twins'. This was the awakening in which the snake, either called Nahasiel or Gamliel, took part - the event that caused evil to become its own entity capable of expression.
The question is then how did Samael and Lilith become paired together? Samael was an archangel of Rome & originally one of the fallen angels in the Book of Enoch. Lilith, on the other hand, was an ancient Near Eastern deity, who was mentioned in Isaiah 34:14, and is known as a danger to infants.
The Alpha Betha of Ben Sira (Pseudo-Ben Sira) states that Lilith was Adam's first wife before Eve. Eli Yassif studied this text in detail and concluded that two versions existed: one similar to the original and one that was edited and enlarged by a later compiler. Examining the differences between the two versions helps to explain how Lilith may have become Samael's spouse.
'When God created His world and created Adam, He saw that Adam was alone, and He immediately created a woman from earth, like him, for him, and named her Lilith. He brought her to Adam, and they immediately began to fight: Adam said, 'You shall lie below' and Lilith said, 'You shall lie below for we are equal and both of us were [created] from earth.' They did not listen to each other. When Lilith saw the state of things, she uttered the Holy Name and flew into the air and fled. Adam immediately stood in prayer before God and said: 'Master of the universe, see that the woman you gave me has already fled away.' God immediately sent three angels and told them: 'Go and fetch Lilith if she agrees to come, bring her, and if she does not, bring her by force.' The three angels went immediately and caught up with her in the [Red] Sea, in the place that the Egyptians were destined to die. They seized her and told her: 'If you agree to come with us, come, and if not, we shall drown you in the sea.' She answered: 'Darlings, I know myself that God created me only to afflict babies with fatal disease when they are eight days old I shall have permission to harm them from their birth to the eighth day and no longer when it is a male baby but when it is a female baby, I shall have permission for twelve days.' The angels would not leave her alone, until she swore by God's name that wherever she would see them or their names in an amulet, she would not possess the baby [bearing it]. They then left her immediately. This is [the story of] Lilith who afflicts babies with disease.' - from the early version of Pseudo-Ben Sira
The main question with this text is: Why would the angels leave Lilith alone after they were ordered by God to bring her back? One conclusion is that Lilith bribed the angels with the promise that she wouldn't harm babies protected by them or their amulets. In the later versions of the text, the author changed part of the account between Lilith and the angels as follows:
'They tried to take her back, but she refused. They asked her: 'Why don't you want to go back? She told them: 'I know that I was created for the sole purpose of making babies ill from their day of birth until the eighth day, when I have permission, and after eight days I have no permission. And if it is a female, [this is so] for twelve days!' They said to her' 'If you do not come back we shall drown you in the sea.' She answered: 'I cannot return because of what is said in the Torah - 'Her former husband who sent her away, may not take her again to be his wife, after that she is defiled, that is, when he was the last to sleep with her. And the Great Demon has already slept with me.'
Samael very quickly came to be the 'Great Demon' of this version - the ha-Shed ha-Gadol who defiled Lilith so she could not return to Adam.