On the surface of the Earth, motion is retarded - both by the Earth's gravitational field (if thrown up!) and by the force of friction or drag. This is why, on Earth, an object in motion soon comes to rest.
But in the vacuum of space, motion is not retarded by the force of friction or drag. Unless close to planets, gravitational fields are weak. This is why, in space, an object in motion need never come to rest.