Conceptually, how do we understand why the homotopy group of noncompact space is well-defined: $$ \pi_k(M) $$ for $\pi_k(M)$ as the homotopy class of the compact sphere $S^k$ to the noncompact space $M$?
For example, many such calculations can be done, but it becomes a calculation of homotopy group of compact spheres. e.g. the $O(3,1)$ is a noncompact Lie group, but we can compute the homotopy group as $$ \pi_1(O(3,1)) = \pi_1(O(3)) \times \pi_1(O(1)) = \pi_1(SO({3})) \times \pi_1( \mathbb{Z}/2 ) = \pi_1(S^3/\mathbb{Z}/2) \times \pi_1( \mathbb{Z}/2 )= \mathbb{Z}/2. $$ Which is related to the homotopy group of spheres.
But how to argue such a homotopy class of the compact space to the noncompact space can be defined? I am not sure what is the best way to imagine how a sphere to wrap around the noncompact space that can be well-defined?
Is this, and, why is this homotopy class an abelian group? (finite or infinite abelian group?)