In this case, "section 2" is the correct way to go, assuming the book is laid out into numbered sections, as "section 2" acts as the actual title of the section.
As mentioned in the comments, "the second section" is also correct, as "second" acts as an ordinal adjective describing which section in order -- it may or may not be labeled as "section 2".
In the case of your other questions in the comments, it's a matter of what the section is named. In a section reserved for comments, it would be "the comments section". Numbers is a bit of a special case here, as one would not generally label a section "Section Comments", and if it were labeled "Comments Section" that is close enough to the non-title usage that people would likely adopt the pattern of speech associated with referring to the type of section rather than the title. ("Scroll to the comments section on the page" would be correct, for instance, even if there is a label "Comments Section".)
Usage of the definite article "the" implies that there is only one of whichever thing your are specifying. In most cases I can think of following your example, you would use the definite article. The exception is when referring to items in a list that are labeled according to their order (Chapter 1, Section B, Article IV, etc...) where you may use the section title as-is. I should note that "Section B" would not be called "the B section", but it MAY be called "the second section" since "b" is usually the second. But much beyond two or three alphabetical enumerations and people will just say "Object N" or whatever.