In my planned fantasy story, the protagonists must escape a dangerous situation by teleporting the ship they're on (a kind of steam-powered ocean liner) into outer space, then back to the ocean surface in a different location. The ship remains in outer space for about 12-15 seconds (which is about how long people can survive without oxygen). I won't go into the mechanics of the teleportation, except to say that it is done by magic, and involves exchanging everything in a certain radius around the object being transported with everything in an identically-sized zone at the destination location.
(Edit: Because of the particular circumstances they find themselves in, they aren't able to select a precise destination for the spell (out of all possible locations in the entire universe), and they're therefore most likely statistically to end up in deep space somewhere. They do have enough control over the spell that sends them back to Earth that they can be sure of returning; it's only the first spell that's completely uncontrolled.)
The problem is that all the oxygen that was surrounding the ship will have dispersed into space, so when they teleport back into the atmosphere, there will be a huge vacuum surrounding the ship that will instantly collapse. As far as I can tell, this would be devastating on a massive scale; the ship would likely be capsized or even destroyed, and everyone on board would be most likely killed or severely injured at the least.
How can I avoid the horrendous consequences the crew would experience in teleporting back into the atmosphere, or at least ensure that the boat remains intact and that as many people survive as possible?
I should mention that even if people sustained grievous injuries that could be fatal given time, it isn't necessarily a problem for the story, since there are supplies of healing elixir on board that can swiftly heal any recent injury. As long as the elixir is administered quickly enough to those who've been fatally injured, they should fully heal within the course of a few minutes. It's becomes a problem when either 100% of the people are grievously injured (meaning no one is well enough to find the elixir and administer it) or killed instantly (meaning there might as well be no elixir at all).
Another thought I had is that perhaps the mechanics of the teleportation cause the air to enter the space around the ship gradually, but it'd have to do so quickly enough that people don't suffocate from being denied air for too long. Also, it'd have to be a natural byproduct of how the spell functions, since nobody in this world has ever been to space before and has no knowledge of the associated dangers of teleporting from a vacuum into atmosphere. But I don't know what justifiable reason there might be for the spell functioning this way.