In a free market, people produce what others need and want. If enough people needed or wanted to go to space, it would happen, and it would happen in the most efficient way to get the people exactly what they wanted. People need to communicate, so tools are created all the time for that purpose privately, and the internet would have been as well.
Smart people work on government projects sometimes, and they create useful things. This does not mean these smart people would not otherwise be working on other projects, and still create useful things. Someone would have created the internet if it were not for the military use, quite possibly sooner than it was created, because all of those brains and resources would not have been tied up by the government.
Charity is very important as well, by which we can help those who need it, and fund worthy research projects for the benefit of society.
In the end, there are three types of transactions:
1. The willing exchange of resources or time for the mutual benefit of both parties.
2. The willing gift of resources of time for the benefit of one party or of society.
3. The forceful taking of resources or time by the threat of violence and harm.
The first two of these transactions are acceptable, the last is not. Even in those rare cases when the third transaction can be said to have led to something good, it does not make that transaction acceptable. It is wrong to steal, and it is wrong to enslave. The fact that the slave's back may have been strengthened by the slavery, or the stolen money was partially used for something good, does not make that third kind of transaction any less evil.