Absolutely , glasses or contacts , corrected to 20/20. However , to be a military pilot you must have 20/20 , without the option of glasses or contact lenses , don't listen to people who say you can't be a pilot with glasses.
I am nearsighted (can't see far) and my rx is -8.5 and -8.0 respectively. I've read that fruits are very important for good eyesight, and I never had a penchant for fruit unfortunately. Vegetables with zeaxanthin are also crucial for your eyes.
Being an astronaut is a very dangerous profesion. Unlike most careers, you cannot simply take a sick day in space, or call 911 for a trip to the local emergency room. Each minute is invested at a massive costs, so it is natural for NASA to want to work with only the fittest and strongest of candidates. Having 20/20 vision means, NASA would have at least one less thing to worry about.
For instance, on one of the recent K2 climbs, one of the mountaneers who had had laser eye surgery, went unexpectedly blind due to the effects of low temperature and low pressure. I do not recall if he died on that climb, but someone like that would have certainly endangered himself, his crew, and the mission.
This will all change as we begin to commercially exploit space. But, for now, the astronauts are pioneers and scientific explorers; which means that we do not know what challenges they may be faced with, and we need to stack every possible card in our favor.
you do not have to have perfect eyesight to be an astronaut.
there are three basic types of astronauts, pilots, mission specialists and payload specialists.
pilots must have vision no worse than 20/50 which can be corrected to 20/20.
mission and payload specialists must have vision no worse than 20/100 correctable to 20/20.