Distance to ellipsoid
The problem is equivalent to finding the closest point on an ellipsoid.
Let SVD decomposition of A be $U \Sigma V^T$. We can substitute $y=\Sigma V^T x - U^T b$. Then the problem $$min\|A x - b\|_2, \quad\|x\|_2=1$$ can be written as $$min\|y\|_2, \quad \|V \Sigma^{-1} ( y+U^Tb)\|_2=1$$ The first expression is minimization of Euclidean distance from the origin and the second constraints the point to lie on a surface of ellipsoid with center $-U^T b$ and dimensions given by diagonal elements of $\Sigma$.
Distance from the point to the ellipsoid can be efficiently computed as described in Distance from a Point to an Ellipse, an Ellipsoid, or a
Hyperellipsoid by minimization of a univariate function. Below is a sample implementation in Python, which uses distance calculation from Geometric Tools
def solve_ellipsoid(A, b):
U, S, V = np.linalg.svd(A, full_matrices=False) # A == U @ S @ V
center = -U.T @ b
axes = np.eye(len(S))
point = np.zeros(len(S))
distance, points = DCPQuery()(point, Hyperellipsoid(center=center, extent=S, axes=axes))
return V.T @ ((points[1] + U.T @ b) / S)
Second-order cone programming
Another option is to use SOCP solver. Unfortunately, it works only in the case when unconstrained least squares solution is outside unit sphere. Otherwise it returns just least squares solution.
General formulation of SOCP program: $$min f^T y, \quad \|A_i y + b_i\|_2 \le c_i^T x + d_i$$
The problem can be solved by introducing slack variable $s$ and finding $y = \begin{bmatrix}
x \\
s
\end{bmatrix}$ with the following substitutions. Then $x$ will be a solution to the original problem (if least squares solution is outside of unit sphere).
$$A_1 =
\begin{bmatrix}
A & 0_n \\
0_n & 0
\end{bmatrix}
,
\quad
b_1 =
\begin{bmatrix}
-b \\
0
\end{bmatrix}
,
\quad c_1 =
\begin{bmatrix}
0_n \\
1
\end{bmatrix}, \quad d_1=0$$
$$A_2 =
\begin{bmatrix}
I_{n\times n} & 0_n \\
0_n & 0
\end{bmatrix},
\quad b_2 = 0_{n+1}
, \quad c_2=0_{n+1}, \quad d_2=1$$
$$f = \begin{bmatrix}
0_n \\
1
\end{bmatrix}$$
Old answer (incorrect):
This problem can be solved using singular value decomposition. The original problem can be stated as
$$min\|Ax-b\|_2, \|x\|_2=1$$
By substituting $$A'=[A;-b], x'=w x; w$$ and choosing $w=\frac{\|x\|_2}{\|x;1\|_2}$ we get $\|x'\|_2=w\|x;1\|_2=\|x\|_2$, so the problem becomes
$$min\|A'x'\|_2, \|x'\|_2=1$$
which is same as in this question: Minimizing $\|Ax\|_2$ subject to $\|x\|_2 = 1$
It can be solved by decomposing $A'$ into $U \Sigma V^T$ and then taking the last column of $V$, which corresponds to the smallest singular value of $A'$.
Finally $x$ is calculated by dividing $x'$ by the last element, taking elements of $x'$ except the last one and then normalizing it.