In 1962, the Mercury program sought to find out if humans could eat in space. This interesting 1966 film captures some of the early trial and error.
One of John Glenn's many tasks, as the first American to orbit Earth in 1962, was to experiment with eating in weightless conditions. Some experts had been concerned that weightlessness would impair swallowing. Glenn experienced no difficulties and it was determined that microgravity did not affect the natural swallowing process.
Astronauts in later Mercury missions (1959–1963) disliked the food that was provided. They ate bite-sized cubes, freeze-dried powders, and tubes of semiliquids. The astronauts found it unappetizing, experienced difficulties in rehydrating the freeze-dried foods, and did not like having to squeeze tubes or collect crumbs. Prior to the mission, the astronauts were also fed low residual launch-day breakfasts, to reduce the chances that they would defecate in flight.
Several of the food issues from the Mercury missions were addressed for the later Gemini missions (1965–1966). Tubes (often heavier than the foods they contained) were abandoned. Gelatin coatings helped to prevent bite-sized cubes from crumbling. Simpler rehydration methods were developed. The menus also expanded to include items such as shrimp cocktail, chicken and vegetables, toast squares, butterscotch pudding, and apple juice.
Bonus video: Chimp Test Pilots:
• What Did Early Astronauts Eat (YouTube / The Best Space Archives)