A theory of the two-stream ion wave instability in a plasma is developed that takes into account both the effect of collisions of the ions and electrons with neutral particles and the presence of a uniform magnetic field. Applying the results to the ionosphere, we find that irregularities of ionization density should arise spontaneously in regions in which a sufficiently strong current is flowing normal to the magnetic field lines. These irregularities will be strongly aligned with the magnetic field and may have a wide range of wavelengths. The various predictions of the theory are in agreement with the observed characteristics of certain field-aligned irregularities found in the equatorial ionosphere that are associated with the equatorial electrojet. Similar irregularities often appear in the polar ionosphere during auroral displays; it seems very likely that these are caused by the auroral electrojet.