Stephen Strange had observed over 14 million versions of the future and this hadn’t been in any of them! He wasn’t on Earth to see Carol Danvers arrive just as Thanos was about to erase half of existence. She had blazed through the sky like a comet, hitting him right as he snapped. Everything became disoriented. Thanos didn’t quite succeed as he intended. Instead of half of life disintegrating completely, the disappearing half merged with the half that stayed behind.
Seemingly against all odds, Strange ended up light years away back on Earth and inside the body of Carol Danvers. He could feel the power of the Tesseract running through his body, though he was certainly more distracted by another aspect of his new body right now. After a quick feel, he knew Thanos was still a threat, and he was sure he now had the ability to neutralize it. He decided to go in for another punch. He flew up and took aim for the Mad Titan.
But as he approach Thanos flinched and shouted, “Please don’t hit me! I’m just a kid!”
Strange stopped. It appeared Thanos wasn’t immune to his own snap and he had been swapped just like Strange (and the rest of the universe). However, it was also apparent that all the stones had been destroyed in the snap, leaving everyone stuck...for now.