In a Sentence:
For a planet to have an ionosphere, we would expect it to have a pressure of at least 1 bar ("thick enough") and to have a host star producing sufficient high-energy photons.
Generation of an Ionosphere
The ionosphere is a balance between plasma production and plasma loss. The primary source of ionization (photons getting absorbed by an atom or molecule, knocking off an electron), is usually high-energy photons. The primary source of recombination (ionized atom or molecule picks up an electron, causing the particle to be charge-neutral), is usually collisions between particles. The chemical composition of the atmosphere definitely influences this balance, too. When there's more ionization, the ionosphere grows. When there's more recombination, the ionosphere shrinks. It can be shrinking at one location and growing in another (see Planetary Rotation, below, for an example).
Location of an Ionosphere
High above the ionosphere, the gas density is low enough that most of the light from a planet's host star travels through the atmosphere without interacting with (i.e. ionizing) the atmosphere. As the light travels downward through the atmosphere, the atmospheric density increases, which causes more high-energy radiation --- particularly extreme ultraviolet (EUV) --- to be absorbed by the atmosphere, causing ionization (plasma generation). Travelling deeper still, the density increases exponentially, but at this depth, most of the high-energy photons have already been absorbed, so there's little ionization happening. Moreover, at this depth, any ions are short-lived due to frequent collisions with the neutral atmosphere that lead to recombination (plasma depletion).
The ionosphere is therefore a "Goldilocks" region in a planet's atmosphere: low enough in the atmosphere for there to be plenty of molecules to absorb high-energy photons, but still high enough that there's still plenty of high-energy radiation from the host star and tenuous enough for recombination to not dominate.
As a very general rule of thumb, roughly $1/e$ of incoming light gets absorbed above the 1 bar pressure level in an atmosphere. (Of course, this varies with wavelength, chemistry, and more....) This is a relatively high fraction of light that has been absorbed, but it's deep enough that collisions between particles are frequent enough for recombination to be more frequent than ionization. Any particles that get ionized quickly become neutralized. Based on this alone (but also substantiated by studies of Earth and other planets), we may conclude that the ionosphere is somewhere above the 1 bar pressure level, but this can vary.
Without an atmosphere, there aren't any molecules to ionize. Therefore, one needs an atmosphere to have an ionosphere.
Since ionospheres tend to be above the 1 bar pressure level (at least in our Solar System), we may guess that a planet needs to have at least 1 bar of pressure in order to have an ionosphere.
A Consistent Source of Radiation
Without high-energy radiation, the atmosphere will not naturally ionize. Usually, this is a host star. (One could also imagine far-fetched sci-fi scenarios with artificially-generated ionospheres....) The host star has to produce sufficient amounts of high-energy photons to irradiate the atmosphere.
I added the word "consistent" to this section. The reason is because if the star "turned off" (or went through a phase where it produced insufficient EUV photons), then charge recombination would slowly dissipate the ionosphere.
Proximity to Host Star / Star Type
Either a cooler host star or the planet being further from the star will cause it to receive less of the high-energy required for ionization. The opposite is also true.
Receiving less radiation means that the fraction of molecules in the ionosphere that get ionized is smaller, leading to a "weak ionosphere" (i.e. one that is weakly ionized).
For a planet receiving more radiation, the ionosphere will be stronger and thicker for two reasons. First, the higher irradiation means that the few molecules at higher altitudes have more chances to ionize, meaning the ionosphere can be taller than it would otherwise be. Second, because there's more radiation, even though $1/e$ gets absorbed above the 1 bar pressure level, there's still a ton of radiation that hasn't been absorbed. Because of this, the ionosphere can be deeper than it would otherwise be.
Different chemical composition could allow an ionosphere to be different than what I've described above. For example, if a planet's atmosphere is primarily composed of a gas that doesn't absorb EUV well, then much of the EUV will penetrate deeper into the atmosphere and would cause the ionosphere to be weaker and/or located deeper in the atmosphere. Or, for a planet with an atmosphere that absorbs EUV extremely well, the ionosphere might be higher in the atmosphere.
In short, the chemistry of the atmosphere can make the ionosphere be located higher or lower in the atmosphere, or cause it to be more strongly- or weakly-ionized.
Earth's ionosphere varies from day to night. At local noon, the ionosphere facing the host star receives the maximum incident radiation, causing more ionization and a thicker/stronger ionosphere. At night, the atmosphere receives essentially no ionizing photons, so recombination makes the ionosphere weaker and thinner. (For the same reason, a planet can have seasonal variations as well.)