a C=O double bond becomes two C-O single bonds, and those C-O single bonds are slightly more stable than the C=O double bond resulting in ΔH being slightly positive.
The tables I found (e.g. OpenStax Chemistry, Wikipedia) have the C=O bond with roughly twice the bond dissociation energy compared to the C-O bond, and in all cases the C=O bond is slightly more stable than the two single bonds. So the statement in the textbook is surprising. As these values are aggregates derived from large sets of molecules, their values will vary depending on which set of molecules they are based on.
If you go from less stable bonds (easier to break, smaller bond dissociation energy) to more stable bonds (harder to break, larger bond dissociation energy), the enthalpy of reaction should be negative (exothermic), not positive as claimed in the statement above.
For completeness, these are not the only changes. In addition, the O-H bond of the hydroxyl group is broken, and the O-H bond of the hemiacetal is formed. If you are estimating bond dissociation energies from a simple table, however, this will just cancel out because it is treated as the same kind of bond.
Estimating enthalpy of reaction with bond energies
Bond energies give you a rough estimate of reaction enthalpy, but will not pick up subtle differences between cases that are treated equally using this estimation. Here are two other examples where a C=O double bond is replaced by two C-O bonds, and the counts of all the other bonds are equal:
- Hydration of a ketone, e.g. acetone and water reacting to form 2,2 propanediol. According to this web site, the reaction is slightly endothermic (about +6 kcal/mol). On the other hand, formaldehyde is mostly hydrated in water, so ketones and aldehydes behave slightly differently.
- Butanone isomerizing to tetrahydrofurane. This is a hypothetical reaction, but NIST data suggests that it is also endothermic, again different than the estimate from bond dissociation energies.
So first, you have to look at the experimental evidence, and then you can try to rationalize it with a simple model, which sometimes will give the expected answer and sometimes will not.
"energetically favorable" vs major species
Just because a reaction is exothermic does not mean the product will be the major species. Not all monosaccharides form rings, and mixtures of ketones and alcohols typically do not form hemiacetals as major species. There are other energetic factors (e.g. ring strain), and entropic factors (e.g. intramolecular vs intermolecular, conformational degrees of freedom) that also contribute to making one or the other species more prevalent.
Why are two C-O single bonds more stable than a C=O double bond (hemiacetal)?
This is what we observe. A simple model like adding up bond energies seems to support it, but maybe that is just luck. Computational methods are sufficiently sophisticated to predict that certain monosaccharides form cyclic hemiacetals. I'm not sure this answers the question of "why?", though.