Once you start training (usually the 3rd or 4th day after you arrive at OCS), the only way you can leave before the 3rd week is by getting hurt, going UA, or doing something criminally stupid. If you try to quit before then, you just get harassed until the 3rd week boards (or later), then sent home. We had two people who, on the second training day, said they wanted to DOR. They spend three more weeks with us getting screwed with incessantly.
As far as how long it takes to leave, it all depends. When I got hurt, there were people from other companies leaving with me who had been to see "The Man" the day before. Someone from a different increment had to spend a weekend in H&S Company because he got dropped on a Friday but they didn't bother doing his paperwork until Monday. So if you quit, be prepared for life to suck. In so many ways.
Don't be one of those idiots who spends 2 or 3 days at in-processing and wants to quit before they start training. Hell, you don't even know what it's all about yet. At least give the training a shot. Like reaper said, by quitting during in-processing basically you just screwed somebody out of an OCS slot and took the Marine Corps for a free trip to Virginia. Not to mention-that's one less person to stand fire watch!
But if you get there and really decide that it ain't for you, by all means, quit. But don't take your pack off. When I was Company Commander, my XO disappeared to go to a board. He came back and told me he had DOR'd. I was surprised-he was the best person on my company staff. So even if you want to leave, don't slack off until you're across the tracks. I never had anything against people who quit during OCS. If they don't want to be there, I don't want to be working for them in the future.