Luffy seems to have developed a positive relationship with Trafalgar Law and his crew, as they braved the Whitebeard War and the attacks of the Marine admirals just to save him.
Although seeing that they are both Supernovas, and therefore rivals, there may be some ulterior motive behind Law’s decision to save Luffy. While on the other hand, Law has been shown to respect Luffy, and could quite simply have come to save him because of that respect. When Luffy met Law on Punk Hazard, Luffy was happy to see him again, not knowing Law’s intentions. Luffy stated, with a happy smile on his face, that he and Law will be enemies if he’s going after the One Piece too, but he is grateful nonetheless.
When Law helped save Nami, he proposed an alliance to Luffy to take down one of the Yonko. To the surprise of their crewmates, he accepted after being told that they would be taking down Kaido saying he intended to take them all down.