The common form for gravity and the electric force comes from the fact that they both involve the exchange of a massless particle (the photon for the electric force and the graviton for gravity) which gives them infinite range and the common inverse square law form.
Gravity and magnetism are both common forces.