How do they know that it is solid?)
TLDR: It's complicated.
Given that we can know how long they actually do take, we can turn around and estimate the mean density along the straight-line path they took. When we determine that the mean density is significantly higher for paths through the center of the earth, that tells us that the material there is much denser, and so we suppose that it could be solid.