Why does energy have to be emitted in quanta? I was reading some popular science book and there was this sentence.
It says that energy has to be emitted in discrete portions called quanta.
Otherwise the whole energy in the universe would be converted into  high frequency waves.
I'm not a physicist, so this conclusion seems to me like a huge leap.
First, we assume that energy is emitted in a continuous way (not in quanta).
And how do we get to the statement "the whole energy in the universe would be converted into  high frequency waves"?
 A: The book is almost surely referring to the ultraviolet catastrophe.
Classical physics predicts that the spectral energy density $u (\nu,T)$ of a black body at thermal equilibrium follows the Rayleigh-Jeans law:
$$u(\nu,T) \propto \nu^2 T$$
where $\nu$ is frequency and $T$ is temperature. 
This is clearly a problem, since $u$ diverges as $\nu \to \infty$ (1). The problem was solved when Max Planck made the hypothesis that light can be emitted or absorbed only in discrete "packets", called quanta.
The correct frequency dependence is given by Planck's law:
$$u(\nu,T) \propto \frac{\nu^3}{\exp\left(\frac{h \nu}{k T}\right)-1}$$
You can verify that the low-frequency ($\nu \to 0$) approximation of Planck's law is the Rayleigh-Jeans law.

(1) To be more specific: if you consider electromagnetic radiation in a cubical cavity of edge $L$, you will see that all the frequencies in the form
$$\nu =\frac{c}{2 L} \sqrt{(n_x^2+n_y^2+n_z^2)}$$
with $n_x,n_y,n_z$ integers, are allowed. 
This basically means that we can consider frequencies as high as we want to, which is a problem, since we have seen that when the frequency goes to infinity the energy density diverges. So, if we used the Rayleigh-Jeans law, we would end up by concluding that a cubic box containing electromagnetic radiation has "infinite" energy. 
It is maybe this that your book is referring to when it says that "the whole energy in the universe would be converted into high frequency waves" (even if, if this is a literal quote, the wording is quite poor).
A: Without quanta, an electron attracted to  the nucleus of an atom would be accelerated as it orbits around it. By accelerated, I don't mean the layman meaning of speeding up but its velocity direction change. Now classical electromagnetism tells us that an accelerated charge emits electromagnetic waves. This is how an antenna produces radio waves for example by accelerating the electrons inside the antenna (in that case speeding them up and slowing them down in turn).
But then the energy radiated as electromagnetic waves implies that the electron looses energy to conserve the total energy, so basically the classical picture (that means without quanta) predicts an atom cannot be stable. So in that picture, all matter would nearly instantly collapse, leaving only a bath of electromagnetic waves. 
That is one possible answer to your question. See also my fellows guess that it could refer to the black body problem!
A: There is also proof that the energy of an EM wave is transferred in discrete quanta from the photoelectric effect. The classical wave theory of light was unable to explain why electrons were only emitted from a metal plate when the frequency of the incident light was above a certain frequency, and why they were emitted instantaneously above this frequency. This could be explained the photon model, which states that each photon has a discrete amount of energy with $E=hf$ and interacts with only one electron, hence the instantaneous emission of electrons when the frequency of the incident light was greater than the threshold frequency.
A: I highly recommend the first chapter of the book Quantum Physics of atoms, molecules, solids, nuclei and particles by Eisberg & Resnick. 
It's an easy read and it's explanation of energy quanta is unparalleled. But I will still try to explain as briefly as possible.
Now classically, a large system of non interacting entities are assumed to follow Boltzmann distribution which allots the probability of an entity possessing an energy in any range. Now combining this with the freedom of all possible continuous energies gives the average total energy to be $kT$ for each entity. 
In the case of black body radiation the entities are the standing waves with fixed wavelength satisfying the condition that they must have nodes at the walls of a black body. Since we allotted the same average total energy to each mode of standing waves and the possibility that every mode can combine to give the total power spectrum, we give rise to divergences at large frequencies as the number of modes can just keep on increasing. This is called the Ultraviolet Catastrophe of the Rayleigh-Jeans formula.
Now experimentally the Rayleigh-Jeans formula suited well at low frequencies but not at higher frequencies . Whereas the power spectrum should go to 0 at higher frequencies, Rayleigh-Jeans formula gave infinities. So to get rid of this problem, the average total energy of the modes should go to 0 at large frequencies and $kT$ at small frequencies.
There are two ways of fiddling with the average total energy for each mode.
1) Either change the distribution law from Boltzmann's to anything else or
2) Change the classical assumption that each mode gets equal average total energy $kT$.
Now Planck was not aesthetically inclined to do the former as that distribution law explained many other phenomena splendidly. So he did the latter. He tried to guess the function by noting that instead of assuming continuous range of energies if he assumes that energy could only take values that are the multiples of a quantity(the minimum possible energy, say $E_o$) then he could get such a desired function.
Now the distribution law is:

a) if we assume $E_o\ll kT$, then average energy $E_{avg}\sim kT$

b) if we assume $E_o\sim kT$, then average energy $E_{avg}\lt  kT$

c) if we assume $E_o\gg  kT$, then average energy $E_{avg}\ll kT$

Recapitulating, Planck discovered that he could obtain $E_{avg}\sim kT$ when the difference in adjacent energies $E_o$ is small, and $E_{avg}\sim0$ when $E_o$ is large. Since he needed to
obtain the first result for small values of the frequency and the second result for large values of frequencies, he clearly needed to make $E_o$ an increasing function of frequencies. Numerical work showed him that he could take the simplest possible relation between $E_o$ and frequency having this property. That is, he assumed these quantities to be proportional. Adding a proportional constant he postulated:
$$E_o=h\nu$$
where $h$ is the proportionality constant (called Planck's constant) and $\nu$ is the frequency.
Using this formula for allowed energies we get the average energy for each mode  as:
$$ \bar{\mathscr E} = \frac{h\nu}{e^{h\nu / kT} - 1} $$
and the power spectra as:
$$ \rho_T(\nu)d\nu  = \frac{8\pi\nu^2}{c^3} \frac{h\nu}{e^{h\nu / kT} - 1}d\nu $$
which fits with experiments phenomenally well:

A: I think the author is referring to the UV catastrophy, a historical problem in physics which first led physicists to discover that electromagnetic energy was quantized.
The problem basically is this: For a system which is in thermal equilibrium each object is radiating and absorbing energy. Since it's in equilibrium the radiative energy emitted by any object in the system is equal to the energy absorbed by the rest of the objects. And the temperature of all the objects are equal.
When trying to calculate the distribution of this radiative energy among the EM spectrum, physicists found that theoretically the proportion of energy contained by radiation of frequency $\nu$ should be proportional to $\nu^2$! (see Rayleigh-Jeans law). This meant that as you went to higher frequencies the energy contained by them would go on increasing without limit so not only practically all the energy would be contained by higher frequencies, but also any system in equilibrium would have infinite energy. This is obviously not what we observe in real life so something was wrong.
It is only when they assumed that energy was quantized that they got a distribution law which not only made sense, but also fit the experimental data beautifully (see Planck's law).
I believe that this explains the context of the statement that the author was making but answering why does energy have to be quantized in reality is a deep, rather philosophical question to which no one really knows the answer.
