A ground is a reference point. You could litterally take any net in your circuit which is supposed to stay at a steady voltage and call it ground. After all voltage sources create a difference of potential (called a voltage) between two nets, regardless of what their potentials are - if they're both fixed externally, there will be a conflict and bad things, but if one of them is fixed the other potential will change accordingly. Generally the ground is taken such that we work with positive supplies predominantly, e.g. ground on the - terminal of a rectifier bridge.
The Earth is taken as the reference potential for electrical supplies: moist in dirt and water patches are good conductors, but above all the equivalent cross section of this fictive conductor is massive. Except during short upsets such as lightning, it has an excellent homogeneity in potential. Why use another conductor for ground which will use more copper and actually be less effective if we can use what's under our feet?
The Earth also has a person protection role. No current is supposed to flow in the Earth because the actual supply circuit is isolated from the Earth, however what if this isolation is compromised (wires eaten by rabbits, children shoving their fingers in sockets...)? Everyone is indirectly connected to Earth (no isolation is perfect), which means that that circuit will now be closed and the only thing that will limit the current going through whatever is closing the circuit (e.g. people) is its internal resistance. Depending on the environment, that resistance can be sufficiently low to kill someone; refer to this thread about what voltages are considered safe. To prevent that, every enclosure is connected to Earth (a Earth-R-Earth circuit has a near-0A current), and the electric supply has a residual current device that compares the current going in and out, and cuts off the supply if there is a leak (through Earth).
The Earth is also useful as a protection against lightning: lightning is just like any dielectric/isolator breakdown, it occurs where the resistance between the charged cloud and the Earth is minimal (see this amazing GIF). High trees, towers etc., and we can't risk relying on luck alone so highly conductive spikes are used to attract lightning, and the Earth is used to dissipate that energy. Loosely said. Normally lightning has enough current flowing to create through Earth and across human legs a voltage high enough to kill them, so it is spread out more evenly.
As usual, I'll warmly welcome anyone correcting me if not accurate.