For $\mathbb{R}^n$: the fundamental theorem of projective geometry (proof:
https://www3.nd.edu/~andyp/notes/FunThmProjGeom.pdf) says that the bijections of $\mathbb{R}^n$ taking lines to lines are the affine maps $x\mapsto Ax+b$ for an invertible matrix $A$ and a constant vector $b$.
For $S^n$: a theorem by the same name shows that the bijections of projective space taking projective lines to projective lines is a projective transformation. One easily uses this to prove the result for the sphere that such a bijection is a linear transformation defined up to positive rescaling, acting on the sphere as the space of rays in a real vector space.
For $\mathbb{H}^n$: Kobayashi defined a Kobayashi pseudometric for projective connections, which determines the usual metric when applied to hyperbolic space, so the unparameterized geodesics determine the metric, and so the diffeomorphisms preserving them are isometries:
S. Kobayashi, Intrinsic distances associated with flat affine or projective structures, J. Fac. Sci. Univ. Tokyo IA 24 (1977), 129--135.