Why does Earth have a magnetic field, while it appears that Venus and Mars have none or very little?
A geodynamo requires a fluid that can carry a current. A widely held but incorrect explanation for Mars' lack of a magnetic field is that Mars' core is frozen solid. Gravitational observations of Mars show that its core is at least partially molten, just as is ours. While a frozen core would explain Mars' lack of a magnetic field, this explanation does not pan out.
A geodynamo also requires rotation. A widely held but most likely incorrect explanation for Venus' lack of a magnetic field is that Venus' rotation rate is too small. High fidelity geodynamo models show that Venus' rotation rate, although small, is large enough to have the potential to sustain a geodynamo.
A geodynamo also requires a sufficiently high heat flux from the liquid core to the mantle to get the fluid moving. This offers a more modern explanation for why Venus and Mars currently do not have an intrinsic magnetic field while the Earth does. Venus and Mars have stagnant lids: No active vulcanism, no active plate tectonics. Hypervulcanism is an extremely efficient mechanism for a planetary object to transfer heat from the core to the surface (and then to outer space). Plate tectonics is a good second option.
A lack of hypervulcanism and a lack of plate tectonics on the other hand results in very little heat escaping from the core. While the cores of Venus and Mars are hot, molten, and spinning, with minimal heat transfer to the mantle, conduction wins over convection. With little or no convection, there's not enough convective currents to sustain a geodynamo.
The most accepted theory for the existence of a magnetic field in our planet is that the field is generated by electric currents due to the motion of convection currents of molten iron in the Earth's outer core driven by heat escaping from the core, a natural process called a geodynamo.
As you can see here https://nssdc.gsfc.nasa.gov/planetary/factsheet/mercuryfact.html, Mercury has a magnetic field which is smaller then Earth's magnetic, but is stable. We also believe that the origin of this field is the same that generates Earth' magnetic field.
And I don't think that there's a good theory for the absence of magnetic field in Venus of its own. But the solar wind induce a magnetosphere in Venus.
And about Mars... "Mars has multiple umbrella-shaped magnetic fields mainly in the southern hemisphere, which are remnants of a global field that decayed billions of years ago" (extracted from wikipedia). I didn't found a better way to explain. You can also read this for further info on Mars magnetic field:http://www.space.dtu.dk/english/research/universe_and_solar_system/magnetic_field