Mahoney basically put a hit on Annalise, meaning the car accident was no accident. Frank rushed to the hospital, realizing what he had done, to try to tell Annalise. Sam stopped him, threatening him to never tell Annalise as it would destroy her, to which Frank agreed. Sam called in his little favor to Frank when he needed Lyla killed. So that's how Sam and Frank are connected. But we still don't know the exact reason why Sam wanted Lyla killed. Sure, she was pregnant with his baby, but killing her seems a bit over the top.