NOTE: The following discussion refers to practices in the United States. Please be aware that the details in your location may be quite different.
In general, in the United States, your undergraduate major does not need to be in the same field as what you plan to study in graduate school. If this is your situation, here are some things to think about:
While your undergraduate degree does not necessarily have to be in the same department or field as your graduate studies, you may have some prerequisite experience and/or course work to make up for grad school—for example, a minimum number of years working in the field, aptitude in a foreign language, or passing a macro-economics course. As you research programs to apply for, look into policies on prerequisites.
For example, at some schools, students can take courses during the first year in grad school; for other schools, students must have prerequisite courses completed prior to enrolling in grad school, either at another institution or sometimes in a summer intensive class provided by the grad school to which they are applying/accepted. In any case, be sure to check early about what they will and won't take—depending on how long ago you took the class or where you took it, they may not accept it.
Some fields, most commonly medicine, offer post-baccalaureate programs specifically to provide students the prerequisites they need before applying to the graduate program of their choice. In fact, enrolling in and successfully completing a post-bac program may even be a prerequisite for entry into an attached graduate program at that school.
Read more about post-bac options in "Taking individual college and university courses". Here are some sample post-bac programs; there are many others:
As for studying a field that's new to you, it's up to you to make the connections between your prior studies, your personal/work experience, and your intended course of study as clear as possible. Non-major course work; volunteer, intern, and paid work; and general life experience can all influence your choice of graduate degree. Use your essay, resume, references, and conversations with admissions staff to explain why you are choosing a new path for grad school.
If you're a recent graduate, you may want to try interning, volunteering, or working in the new field that you want to focus on in your graduate education before you apply—this is advisable for many reasons, but it's essential if you just can't find a way to link your undergraduate studies to your current interests.
If you have been out of school for a few years, explain—in writing or conversation—how you've discovered your interest in the field since completing your undergraduate studies. You may have worked several years in an area close to your intended field of graduate study, and this can count as much as, or even more than, your undergraduate major.
List relevant course work as well as volunteer, intern, and job experience in the resume you include with your application.
Choose people to write your letters of recommendation who are familiar with your experience in the new field. These could be professors of relevant courses, or supervisors at relevant internships or jobs you have held.
These articles also discuss the process of communicating your experience and abilities to the admissions team:
In all cases, your ability to connect their program with your future goals is critical. In other words, what about the graduate program's focus attracts you, ignites your passion, and creates a link between your past experiences and the impact you plan to have in the world? If you can't convince yourself of the connections, you're unlikely to convince admissions staff, either.