Law knows that escaping from the island will be difficult and that too with two admirals, fuji and sengoku on his tail, it will be pretty much impossible without sunny-go's coup de burst. Now, once they leave the island, they will be chased by marine warships, which might lie outside his operation room range and attack/pursue them indefinitely. To avoid this scenario, he will destroy all the marine warships, and that's why he left barto's group.
I remember back in enies lobby sanji had disappeared for a while, where it was later revealed that he went to close the gates of justice so as to cause a hindrance to the marine warship
I think law is upto doing something similar.
Though it's highly probably that he will encounter Sengoku on his way back and we might get a flashback on sengoku receiving the news of corazon's death.