Do you know the points A and B on the sphere? If not and these are points in space around the sphere, I think it'll be easier to first project them onto the sphere, keeping track of the original point's distance from the surface.

This might help for starters, calculating the distance between the two points along the surface of the sphere:

A, B = points relative to sphere with center origin of [0,0,0]
r = sphere radius
dot# = (A.x * B.x) + (A.y * B.y) + (A.z * B.z)
distance = r * acos(dot# / r^2)

Example in 2D:

c = makeColor(255,255,255)
c2 = makeColor(255,0,0)
c3 = makeColor(0,255,0)
Type Vector2D
x as float
y as float
EndType
A as Vector2D
B as Vector2D
radius = 150
// Stationary point
angle = random(0,360)
A.x = cos(angle)*radius
A.y = sin(angle)*radius
do
// Dynamic point follows mouse
B.x = getRawMouseX() - 400
B.y = getRawMouseY() - 400
d = sqrt(B.x^2 + B.y^2)
B.x = (B.x / d) * radius
B.y = (B.y / d) * radius
dot# = (A.x * B.x) + (A.y * B.y)
distance# = acos(dot# / radius^2)
drawEllipse(400,400,radius,radius,c,c,1)
drawEllipse(400+A.x,400+A.y,10,10,c2,c2,1)
drawEllipse(400+B.x,400+B.y,10,10,c3,c3,1)
print(distance#)
Sync()
loop

Here's an idea I have.

Red (A) is trying to get to

green (B). If you draw a straight

path between them but then plot those points to the surface of the sphere (the pink dots)

1. Use linear interpolation (LERP) to move along the straight path. P is a point on that path, t is a value from 0 (A) to 1 (B).
P = A + (B - A) *t
2. Project that point to the surface of the sphere (S).
D = S - P (direction)
normalize D
W = S + D * radius
Where 'W' is your new point along the surface

Working example (2D):

c = makeColor(255,255,255)
c2 = makeColor(255,0,0)
c3 = makeColor(0,255,0)
blue = MakeColor(0,0,255)
Type Vector2D
x as float
y as float
EndType
A as Vector2D
B as Vector2D
P as Vector2D
radius = 150
angle = random(0,360)
A.x = cos(angle)*radius
A.y = sin(angle)*radius
angle = random(0,360)
B.x = cos(angle)*radius
B.y = sin(angle)*radius
t# = 0
do
dot# = (A.x * B.x) + (A.y * B.y)
distance# = acos(dot# / radius^2)
drawEllipse(400,400,radius,radius,c,c,1)
drawEllipse(400+A.x,400+A.y,10,10,c2,c2,1)
drawEllipse(400+B.x,400+B.y,10,10,c3,c3,1)
if getRawKeyPressed(32)
angle = random(0,360)
A.x = cos(angle)*radius
A.y = sin(angle)*radius
angle = random(0,360)
B.x = cos(angle)*radius
B.y = sin(angle)*radius
t# = 0
endif
if t# < 1
inc t#, 0.01
endif
P.x = (A.x + (B.x-A.x)*t#)
P.y = (A.y + (B.y-A.y)*t#)
// Normalize
d# = sqrt(P.x^2 + P.y^2)
P.x = P.x / d#
P.y = P.y / d#
P.x = P.x*radius
P.y = P.y*radius
drawEllipse(400+P.x,400+P.y,10,10,blue,blue,1)
print(t#)
print(distance#)
Sync()
loop