If each soldier was firing when his rifle was loaded wouldn't that result in more bullets being fired per minute because he doesn't have to wait on command to shoot? If so, why would you opt to use volley fire? Is it a relic of pre-firearm warfare?
There are two distinct types of "volley fire", each for a different (but related) purpose. First, volley fire can be used for sustained fire. Firing is done by command to avoid everybody firing at once (and therefore needing to reload at once). This can be done by firing by ranks, e.g., by the front rank firing, and then the 3rd rank moving forward to become the new front rank and firing, etc. It can also be done by firing by platoons. If everybody is reloading at once, the enemy can close with a sudden charge. It usually takes 20-30 seconds, or longer, to reload a muzzle-loading gun or a crossbow, and a charging enemy can cover a substantial distance in this time. This type of volley fire ensures that a large fraction of your force (e.g., 1/3) is ready to fire on a charging enemy at close range. Andrade (2016) gives a good discussion of early volley fire of this type, including both Chinese volley fire with crossbows dating back the the Warring States period (in the 1st millenium BC) and the 16th century introduction of volley fire with guns.
It might not seem necessary to do this type of firing systematically, since if the soldiers are loading and shooting as quickly as possible, there should be soldiers who will finish loading and shoot before an enemy charge reaches them. However, soldiers are not always firing as quickly as possible, and without SOP otherwise, there are circumstances when they will tend to all shoot at once. An enemy preparing to charge can incite such firing. On example is the North American tactic of a horseman riding across the enemy front in order to draw fire; this was called "emptying the enemy's guns", and was used in native-vs-native warfare and also native-vs-US warfare. (A fictional accidental example of this occurs at the beginning of Dances with Wolves (1990), with Dunbar's attempted suicide ride. Non-suicidal riders would usually use their horse for cover as much as possible.)
The second type of volley fire is quite the opposite: everybody firing at once, the thing that the first type aims to avoid. This type of firing is used to maximise the morale impact and/or the physical effect by reserving fire until the enemy is in point-blank range. This type of fire is often followed by independent firing as quickly as possible.
Reserving fire to point-blank range is related to the anti-charge purpose of volley fire by ranks (or similar). The difference is that the enemy charge is apparent and planned for, while firing-by-ranks is precautionary, in case the enemy suddenly charges. If the soldiers defending against the charge will only get one shot while the enemy is in effective range during their charge, it is most effective to fire when the enemy is close - "fire when you see the whites of their eyes".
References:
Andrade, Tonio, The Gunpowder Age: China, Military Innovation, and the Rise of the West in World History, Princeton University Press, 2016.
Dunbar's suicide ride from Dances with Wolves (1990): https://www.youtube.com/watch?v=oK_wtjlQcns