In the excerpt you posted, along means that those four million soldiers all invaded the country crossing the front. They crossed the front over a length of 2900 kilometers. This does not mean that each soldier walked 2900km to cross the front. It means that the front was 2900km in length, and that the distance between the first soldier who crossed it on, for example, the east side, was 2900km away from the last soldier who crossed it on the west side.
In your first sentence, this works fine. The army would be crossing the border over a long distance. They can enter the country across a 2900km border. The border is not 2900km thick, but the 'line' of soldiers crossing it is 2900km long.
Now this may pose a problem in your sentence with main road. The phrase along the road could be understood as the soldiers walking on the side of the road and entering the country in that way. I doubt that along the main road could have the same meaning as with border where it is understood that the soldiers actually cross that border. When reading that they entered along the main road, I do not get the impression that they actually crossed it, instead I understand that they made their way into the area while staying on the side of the road.