This question puts together lots of cool general ideas to get the answer fairly simply.
- Gauss' Law: For a spherically symmetric mass distribution such as (approximately) the Earth, all the mass in the spherical shell outside a given radius r has no net gravitational attraction for a test mass at any radius r or less from the centre; whereas the net effect of all the mass inside that radius is as if it were all concentrated at the centre. Thus if R is the Earth's radius and the ball is a distance r < R from the centre of the Earth, it (the ball) feels only the gravitational attraction of the fraction of the Earth's mass within a shell at radius r. In the approximation that the Earth has uniform density, this would be a fraction (r/R)^3 of the Earth's total mass M.
- Inverse Square Law: On the other hand, r is closer to the centre than R and the gravitational force falls off as 1/r^2 so that factor would be (R/r)^2 times larger at r than at R. Thus the net difference between the gravitational force at r and that at the Earth's surface (in this approximation) would be the product of (r/R)^3 and (R/r)^2, or just r/R. That is, the force (and therefore the acceleration) of gravity on the ball is simply proportional to its distance from the centre of the Earth, dropping to zero at the centre from one normal "gee" at the Earth's surface.
- Linear Restoring Force and Simple Harmonic Motion:
Any time an object is pulled back toward its equilibrium position (in this case, the centre of the Earth) by a force linearly proportional to its displacement therefrom, we call it a "linear restoring force" obeying the same Hooke's Law as a spring, F = -kx, where F is the force, x is the distance from the equilibrium position and k is the "spring constant".
And a mass on a spring, when pulled away from its equilibrium position, will execute Simple Harmonic Motion (SHM) - it will oscillate back and forth at an angular frequency given by ω = sqrt(k/m) where m is the mass of the object.
In this case we replace x by r and k by mg/R where g is the acceleration of gravity at the Earth's surface, 9.81 m/s^2.
This gives an angular frequency ω = sqrt(g/R). We can plug in the earth's radius R=6.38x10^6 m and take the square root to get = 1.24x10^(-3) s^(-1).
- Period of the Oscillation: ω = 2pi/T where T is the period of the oscillation and pi = 3.14159....
So we get a period of T = 5067 s = 84.45 min, meaning that (in the complete absence of any friction) if you drop a ball into a perfectly straight hole through the centre of the Earth it will fall to the centre and carry on up the other side, stop for an instant at the exit end of the hole on the other side of the Earth, and then fall back through, returning to your hand exactly 84.45 minutes later.
- Transportation Opportunities: Naturally, a round trip is most interesting if one can stop for a visit at the other end!
In this case there is nothing to prevent doing so (except for the technical challenges of creating such a hole in the first place, keeping it from being crushed by the immense pressures and evaporated by the intense heat at the centre of the Earth, and maintaining the prefect vacuum necessary to avoid all friction). Just make a hole big enough for an elevator, hop in and drop, and 42.23 minutes later your friend in the South China Sea (or wherever the opposite point on Earth is for you) can reach out and grab the elevator just as it comes to rest at the other end. When you are done visiting, hop back in and drop again to head home in another 42 minutes. Sure beats a 16 hour plane ride, eh? Also you get to enjoy (?) 42 minutes of weightlessness on each ride.
Alternatively, if you really enjoy weightlessness, you could just keep oscillating back and forth forever. But make sure there really is NO friction, or you may find yourself falling a little more short of the Earth's surface on each trip - not a pleasant long-term prospect....
- "Chord" Travel: I won't go through the solution of the same problem for a hole following a straight line between any two points on the Earth's surface (what we call a "chord") but "it can be shown" that this gives exactly the same answer! As long as there is no friction, a "car" starting out at one end will head downhill, build up speed and then coast past the midpoint to arrive at rest at the other end in 42 minutes. This starts to get more interesting, eh?
- Technical Problems and Possible Solutions: First, of course, there are a lot of approximations here that aren't really valid. For one, the Earth is rotating; so there is a Coriolis "pseudoforce" acting "sideways" all the time you fall and rise past different r. It is probably possible to find a path for which you still won't scrape the sides (basically just allowing for the fact that the Earth turns around you) but then you would arrive at the other side moving about 928 m/s (3340 km/hr) relative to the surface on the other side of the Earth, which isn't too convenient.... So you will not actually get to experience "zero gee" until the Earth stops rotating (a while from now). Second, there are the obvious technical difficulties of drilling and maintaining a perfect hole through the hot, high-pressure and mostly liquid mantle of the planet. I wouldn't want to tackle that one, even with good engineers! In fact, as soon as you get more than about a mile down into the Earth's crust, even in places like Ontario where the magma doesn't come very near the surface, it gets pretty hot. So even "chord coasting" runs into the same problem. You can calculate how far apart two points are along a great circle (the shortest path across the surface of the Earth) if the chord between them goes no further than, say, 2 km below the Earth's surface. It is about 160 km, not an impressive distance to travel in 42 minutes (an average of only 227 km/hr). Still, if one could manage a truly frictionless transport, it wouldn't cost any energy.... All this might be a little more practical on (in) the Moon, if and when we get there in enough numbers to be interested in ground transportation.
I will leave it to you to show that the transit time will be the same for any spherical body of the same density as the Earth.