Try throwing this expression on a 3D layer's scale property with a camera in your scene named "Camera 1"
camZ = thisComp.layer("Camera 1").position[2] * -1;
layerZ = position[2];
scaler = (1/(camZ / layerZ)) * 100 + 100;
[scaler, scaler, scaler]
When you move the layer around in Z, it'll scale to appear the same size from the camera's point of view. Then create another camera that you animate -- when the second camera matches position with the original camera, all your objects will line up.
I made this a long time ago, but if I recall correctly, it may be off if you use a camera that isn't 50mm, but it should get you started at least! There's probably a more elegant way to do this that Dan Ebberts has already figured out. ;)
- Nathan