This is an addendum to the mostly correct answer by jkien.
The overall presentation is largely borrowed from here, but the actual facts come mostly from these sources: here, here and here.
One has to be careful when saying that the practical units (the volt, the ampere, etc.) were 'coherent with' the meter-kilogram-second (MKS) system.
If by 'MKS' we mean a three-dimensional mass-length-time system, then the volt, the ampere, and the ohm were most definitely not coherent units in it. (However—and this will be the key—the product volt × ampere, which was named the watt, is a purely mechanical unit—of power—which was coherent in MKS. It is that fact—that the watt is coherent in MKS—that truly was a lucky accident.)
On the other hand, if by 'MKS' we really mean a four-dimensional, MKSX system, where 'X' is the unit of some non-mechanical electric quantity,1 then it is incorrect to say that it is an accident that the volt, the ampere, etc. were coherent units in such a system—of course they were, since one of them was chosen to be a base unit!
1Serious consideration was given to proposals where X was either the coulomb, or the ampere, or the ohm, or the volt. Eventually, metrological considerations turned out to favor the ampere.
The key here are the units that straddle both the electric and the mechanical domains—in particular, the watt. It is those units that would have made it impossible to extend the CGS system by e.g. adding the ampere to it as a fourth independent base unit: the watt is not equal to the erg per second, and so would not be a coherent derived unit in such a system. However, the watt does turn out to be kg × meter2/second3, and so the practical electric units can be integrated with the MKS system by adding a fourth independent base unit.
At the time the 'practical' electric units were adopted (1873–1893), everyone as a matter of course assumed that a scientific system of units should be absolute, meaning that the base dimensions should be just the three mechanical ones: length, mass, and time. The abvolt, for example, is g1/2cm3/2/s2 when expressed in the base cgs units (see here). Now, there is indeed an absolute (i.e. a three-dimensional, length-mass-time) system is which the practical units are coherent, but it is not the meter-kilogram-second system. It is, rather, a system in which the base unit of length is 107 meters (called a quadrant, as it is very nearly one half of a meridian of the Earth), and the base unit of mass is 10-11 grams (an eleventh-gram): the quadrant-eleventh-gram-second (QES) system.
This can be derived from the following facts. The practical units were defined in 1873 as decimal multiples and submultiples of the 'electromagnetic' absolute cgs units, cgs-emu. We will somewhat anachronistically use the following names for the emu units: the 'abvolt' for the potential, the 'abampere' for the current, etc.1 When expressed in the base cgs units, the abvolt is g1/2cm3/2/s2, the abampere is g1/2cm1/2/s, and the abcoulomb is g1/2cm1/2 (see here, here, and here). On the other hand, the volt was defined as 108 abvolts, the ampere as 0.1 abamperes, and the coulomb as 0.1 abcoulombs (see the same three links). Now imagine we change the base units of lenghts, mass, and time by factors of M, L, and T, respectively. Then the base unit of potental will become (M g)1/2(L cm)3/2/(T s)2 = M1/2L3/2/T2 × g1/2cm3/2/s2 = M1/2L3/2/T2 abvolts. We want this new unit to be the volt, so we must have M1/2L3/2/T2 = 108. Similarly, if we want the new unit for current to be the ampere, we obtain that M1/2L1/2/T = 0.1, and if we want the new unit of charge to be the coulomb, we obtain that M1/2L1/2 = 0.1. We thus have a system of three equations with three unknwns. The solution is L = 109 (so the base unif of length should be 109 cm = 107 m), M = 10-11 (so the base unit of mass should be 10-11 g), and T = 1 (so the second remains the base unit of time).
1This naming convention, where the name of the emu unit is formed by adding a prefix 'ab-' (short for 'absolute') to the name of the corresponding practical unit, came only in 1903, three decades after the practical units were originally defined in terms of the absolute emu units. At that earlier time, the absolute cgs electric units themselves didn't have any special names. One just used 'e.m.u.' or 'C.G.S', as in 'a current of 5 e.m.u.' or '5 C.G.S. units of current' (or perhaps one could also use the base units, e.g. a current of 5 g1/2cm1/2/s) However, for convenience, we will use 'abvolt', 'abampere', etc. in what follows.
The way the meter-kilogram-second system enters the story is this. In addition to the purely electric and magnetic units such as the ohm, the volt, the ampere, etc., the practical system of units also had to include some purely mechanical units. This is because of relations such as voltage × current = power. In particular, the volt times the ampere gives a unit of power, which was in 1882 given a special name: the watt. Then the watt times the second gives a unit of energy, which was named the joule. Of course, these purely mechanical practical units were coherent in the QES system. However, they are in fact coherent in a whole family of systems. To see why that is so, recall that the dimensions of power are ML2/T3. It follows that if the watt is coherent in a system, it will also be coherent in any system obtained from the original system by simultaneously changing the base unit of length by a factor of L and the base unit of mass by a factor of M in such a way that ML2=1, i.e. in such a way that M=L-2. We are told that the watt is coherent in the QES system; thus, it will also be coherent in any system in which the base unit of length is L × 107 meters while the base unit of mass is L-2 × 10-11 grams. Picking L = 10-7 gives the meter and the kilogram. Moreover, it is easy to check that, if we insist that the new base units should be decimal multiples or submultiples of the meter and the gram, then the choice L = 10-7 is the only choice that produces base units of practical sizes. For example, if we pick L = 10-8, so the base unit of length is the decimeter, then the base unit of mass becomes 1016 × 10-11 grams
= 105 grams = 100 kg, which is impractically large.
Probably many people noticed that the watt is coherent in the meter-kilogram-second system, but it was Giovanni Giorgi who really took note of it. He had the further insight—which was sort of iconoclastic at the time—that while the purely electric and magnetic units cannot be made coherent in the three-dimensional meter-kilogram-second system, they could be made coherent in a four-dimensional extension of that system. Thus he proposed, in 1901, to introduce a fourth base dimension, which would be purely electric or magnetic. In principle, this fourth independent dimension could be any electromagnetic quantity, but only four received serious consideration: electric charge, electric current, electric resistance, and electric potential. Eventually, electric current was chosen because it was most advantageous metrologically. Another selling point of Giorgi's system was that it made it possible to rationalize (i.e. remove the awkward factors of 4π from) Maxwell's equations without a corresponding redefinition of units by factors of (4π)1/2 (which is what happens when the Gaussian system is rationalized, giving the Lorentz-Heaviside system).
The Giorgi proposal (with the ampere as the fourth base unit) was adopted by the International Electrotechnical Commission in 1935 and by the CGPM in 1946; the CGMP later incorporated it into the SI system.
The fact that the kilogram rather than the gram is the base unit of mass in the SI is all the more remarkable given that, for about a century, the scientific community had been almost universally using the centimeter-gram-second system. Let me summarize the main reason why the CGS was abandoned and the meter-kilogram-second (MKS) was adopted. The main background facts to be aware of are that (a) by the end of the 19th century, the so-called 'practical system' of electric units had become nearly universaly accepted in practical applications of electricity such as telegraphy, and (b) this system of units included the volt and the ampere, and therefore also their product; but this product is a purely mechanical unit (of power), and if one multiplies that by the second, one gets another purely mechanical unit (of energy). In 1882, these two units were named, respectively, the watt and the joule. Now: the MKS is the unique system which has all three of the following characteristics (and which keeps the second as a unit of time): 1. the watt and the joule are coherent, 2. the base units of length and mass are decimal multiples of the meter and the gram (so that the system is 'properly metric'), and 3. the sizes of the base units of length and mass are convenient (more or less) for practical work. All this assumes that the second remains the base unit of time; but it is definitely true that any proposal to replace the second would have been dismissed out of hand. The non-mechanical units such as the volt, the ampere, etc. are not coherent in a three-dimensional MKS system, which is why a fourth independent dimension was added: the ampere became a new base unit, dimensionally independent from the meter, the kilogram, and the second.