I think that the use of a typewriter increased the usage of underlining (you can't simply change the font of a typewriter). So it was easier to go back and underline the word or the complete heading.
In a well printed book or thesis you will never see an underlined word or words. If you have the possibility to use italic font (or a typewriter font for urls) you should do it.
- If you are a typographer, and you know exactly what you are doing, you can use it.
- If you are not a typographer, use justified text with hyphenation and use italic font for marking or use a color.
Writing your thesis (your given example shows one): do not use underlining (that shows you know nothing about good typography). Use italic font. Please have a look in a book on typography like Bringhurst's The Elements of Typographic Style.
Have for example an look to Spache research, 1965. I think it is written with an typewriter. That causes the underlining. The (blue) underlining in the TOC remarks that the headings in TOC are links to the chapters or sections.
An interesting book for this is The technology of text; with a few underlinings, remarking that students when working with books used to underline important things in it. That would be a reason for me not to use underlining in a book or paper.