Which is the correct sentence? Why?
- It's the first time he has been in space.
- It's the first time he has been to space.
Both are acceptable and the choice must be made based on whether you wish to emphasize the rocket flight to space or the experience of being in space.
In other words if he made the comment, "This thing feels like it's going to fall apart any second, I'm getting nervous." I might comment to my fellow astronauts, "Heh, you can tell that this is the first time he's been to space."
But if we were in the space station and he made the comment, "I keep feeling like I'm going to vomit. When does it stop?" I might comment to my fellow astonauts, "Heh, you can tell that this is the first time he's been in space."
Both are correct but in my experience He has been to space would be used more often. I would usually understand space to be a destination (rather than a medium). If you said He has been in space I might think you were talking about a space walk - he has gone outside the spaceship into space. Think of the difference between going to the sea and going in the sea. With space you have to do both at the same time.
To summarise you go to a destination but you go in or into a substance, medium, building, vehicle, enclosed space, etc. Some words like space and kitchen can be either depending on the sentence. He went to the kitchen, now he's in the kitchen. You might say He went into the kitchen but you'd be unlikely to say He went in the kitchen. It's not wrong, it's just not used that much.