  We consider a simple model describing a closed bosonic string in a constant
magnetic field. Exact conformal invariance demands also the presence of a
non-trivial metric and antisymmetric tensor (induced by the magnetic field).
The model is invariant under target space duality in a compact Kaluza-Klein
direction introduced to couple the magnetic field. Like open string theory in a
constant gauge field, or closed string theory on a torus, this model can be
straightforwardly quantized and solved with its spectrum of states and
partition function explicitly computed. Above some critical value of the
magnetic field an infinite number of states become tachyonic, suggesting a
presence of phase transition. We also construct heterotic string
generalisations of this bosonic model in which the constant magnetic field is
embedded either in the Kaluza-Klein or internal gauge group sector.
