Consider creating your own characters and story lines. While you can pitch a story line based on an already established or ongoing story line with one of these companies, your chances are better if you pitch original work. Ongoing story lines are usually assigned to writers and artists and scripted well in advance.
Think about taking a few art classes. Writers aren't required to illustrate their own stories at Marvel and DC, but some do. The ability to illustrate some of the story you plan to pitch to either of these major comic companies will give you an extra edge when you pitch your story. The ability to draw is a way to get your foot in the door at one of the major comic publishers.
Attend comic book conventions. Both Marvel and DC have instituted policies against accepting submissions by mail. They do have policies in place for accepting submissions at comic book conventions (see Resources), so this is your opportunity to get your work directly into the hands of the people at Marvel and DC who have the power to buy it.
Post your work at Deviant Art and other comic presentation web sites (see Resources). Consider making your own writing blog. Web sites like these are scouting grounds for Marvel, DC and other comic book companies.
Work as an intern at Marvel or DC. Both companies accept internships (see Resources). The positions are not paid, but it does get you into the company, which puts you near the people who have the power to look at your work and to purchase it.
Pay attention to submission guidelines (see Resources). It is possible to become a freelance writer for Marvel or DC, but both companies have specific submission guidelines in place that need to be followed. Following the guidelines is your best chance for success. Most importantly, be sure to attend as many comic book conventions as you can (see Resources). Networking with Marvel, DC and other comic industry representatives is the best way to get your work looked at.