The gas gains no net momentum in the direction perpendicular to the direction the nozzle is pointing, even so it also expands in this direction. There are gas molecules moving in all possible perpendicular direction, and as we add their momenta vectorially, the perpendicular components cancel out. The nozzle is designed to minimize the perpendicular components and maximize the components in the direction the nozzle is pointing. When the astronaut reaches the ship, the astronaut and the ship can accelerate together by firing a rocket. The rocket works on the basis of the same physical principle as the astronaut's jetpack.
Gas is ejected and gains momentum in a given direction.
The ship gains momentum in the opposite direction. High-pressure gas is obtained by burning fuel. After the rocket has been fired, chemical energy, which was stored in the rocket fuel, has been converted into kinetic energy of the gas and the ship. The center of mass of the system does not accelerate. If a rocket takes off from a launch pad on earth, the force of gravity is acting on it.