Consider first what happens when the rocket travels with constant velocity. Constant velocity implies that there are balanced forces (or indeed no forces) acting on the rocket. This is Newtons 1st Law. We know the rocket will maintain its trajectory. Equally so, once the ball has left the thrower's hand, there are no forces on the ball. As such, the ball will steadily make its way, at a constant speed, from the back to the front, in a straight line. ('Deep space' implies there are no external gravitational influences to affect the balls trajectory, we dont need to worry about tidal forces from the moon!) Now consider the scenario where the rocket accelerates. The key to this part is to recall Einstein's General Equivalence Principle; that the effects of acceleration and gravitation are essentially the same. We can replace the current scenario with a much simpler picture: a person throwing a ball up on planet Earth (i.e. in a gravitational field). The ball will be thrown up, constantly accelerated downwards, and will return to the thrower's hand. We can make this replacement because an accelerating frame of reference (like that of the rocket) is exactly equivalent to a frame of reference in a gravitational field; this is what Einstein tells us from General Relativity.