They meet when Cain kidnaps Lucifer. Lucifer will seek by all means to discover the identity of his kidnapper. He eventually found out that he was an immortal, and later stabbed Marcus Pierce to make sure he was Cain.
Pierce dies stiffly dead and then gets up suffering a few moments later. Shortly after Pierce explains his reasons later in the night, Lucifer and Cain end up contracting for the mutual purpose of angering God.
Lucifer is committed to freeing Cain from the curse that forces him to live forever by killing him even if it would cost him his life. Lucifer will first try to understand Cain to see if in this way Cain would not become vulnerable a little bit like Chloe on Lucifer. This process allowed Lucifer to understand Cain and a new friendship based on animosity and the desire for vengeance that the two characters feel towards God was born.
Their friendship started to decline after Cain and Chloe started dating and then became engaged (which led to Cain finally losing his mark) and Lucifer became jealous of the pair. Luckily for Lucifer Chloe chose to break it off when she realized that she didn't love Marcus and wanted to be with Lucifer. After Cain killed Charlotte Richards (by mistake, he was trying to kill Amenideal in order to anger God into giving him his mark back), Lucifer prepared himself to take Cain down. After being outed as the Sinnerman Lucifer and Chloe went after him which ended with Lucifer killing the now mortal Cain with one of Maze's Hell-Forged demon blades. As he laid on the ground dying Lucifer taunted him saying he will torture himself in Hell.