I don't think every answer to this (and everything about Doctor Strange) can be the 14 million possibilities thing. Sometimes (like here) there's a better explanation.
Something you assumed in your question is actually incorrect:
so there was a lot of time and Dr. Strange could have transported them back to earth using his sling ring
There wasn't much time at all. The entire sequence from Thanos arriving in Wakanda (after leaving Titan) and until the "snap" is about 6 minutes in movie time, probably less for the characters since much of those minutes is in slow motion. During those few minutes we get a glimpse of the team on Titan picking themselves up, Tony Stark fixing his wound and so on. Then the snap happened and people started dying, including Dr. Strange. He didn't transport himself and others to earth simply because it happened too quickly.
Granted, it's possible that he knew that Stark has to live (which is why he gave his time stone) and maybe that also implies that Stark needs to be on Titan as well. However given the little time Strange could even react to what's happening, this isn't something that really needs that explanation.