Scaling an object from point A to point C with python
Basically you determine the start point and the end point. Then you calculate the distance between the two points and scale the object according to this distance.

Unfortunately you did not mention where your start and your end point are supposed to be. For simplification I assume the origins of objects A and C.

import bge

scene = bge.logic.getCurrentScene()    
objectA = scene.objects["A"]
objectB = scene.objects["B"]
objectC = scene.objects["C"]

startPoint = objectA.worldPosition
endPoint = objectC.worldPosition

distance = (endPoint-startPoint).length


Here you know the parameters you need. To make it simpler you can place the origin of object B at one of the caps and ensure it has a length of 1.0 along the axis to stretch along (I assume it is Y). With that assumptions you can 


place object B at the start point 
point to the endpoint 
apply the scale


in code it can look like this

AXIS_Y = 1
objectB.worldPosition =  startPoint
objectB.alignAxisToVect(endPoint-startPoint, AXIS_Y)
objectB.localScale.y = distance


 results in 

When you do not want to move the origin of object B, you need to compensate that in your formula. Assuming the origin is exactly at the center of axis Y:

objectB.worldPosition =  startPoint + (endPoint-startPoint)/2


I do not want to go into detail when the origin is not at the center. I do not think it is worth the effort at this stage.

Remark:

As mentioned earlier the above description uses the center of A and C as start and end point. You might supposed to use the surface of the meshes. In this case you need to determine these two points differently (e.g. via ray measure). But this is a different topic.