When you declare a major as an undergraduate, you agree to fulfill the qualification requirements and/or prerequisites of a particular department at your school. Typically, this means you need to take a minimum number of courses/credits within that particular department, plus a selection of elective classes from other departments. (For instance, if you were studying for a major in Economics, there may be a requirement to take your choice of a Science elective.). As an undergraduate, you may also have to declare a Minor (in another department), which requires far fewer courses than the Major course of study.
“Declaring a Major” at graduate-level degrees is a little different. Usually, when you apply to a university, you are also applying to a specific school (Political Science, History, Physics, Computer Science, etc.). That school will, of course, have its requirements to obtain a degree.