Once a foreign-born person files an adjustment of status application in the United States, so as to obtain lawful permanent residence (a green card), it's important not to leave the U.S. without first obtaining what's known as Advance Parole. Basically, this is a travel document allowing you the right to return to the United States; and it's also a way to indicate to U.S. immigration authorities that you aren't abandoning your adjustment application. But how long does Advance Parole allow you to stay outside the U.S.? Would two months, for example, be too long?
Applicants can (and should) request Advance Parole at the same time they submit an adjustment of status application to U.S. Citizenship and Immigration Services (USCIS). It doesn't cost any extra, when it's part of an adjustment application.
Applying for Advance Parole isn't hard to do—you simply include Form I-131 with the rest of your adjustment packet of forms and documents. And USCIS usually approves Advance Parole when it's part of an adjustment application, almost automatically.
Don't leave the U.S. until your Advance Parole document arrives, however—it will be crucial to keeping your adjustment application alive and in processing while you're gone. (In other words, leaving the U.S. without Advance Parole would cause USCIS to cancel your adjustment application.)
Now, as to the matter of how long you can stay away. Advance Parole is normally granted for multiple entries into the U.S. and for the time period required to complete the adjustment of status application, not to exceed one year. This isn't set out in the law anywhere; it's a matter of USCIS policy.
So theoretically, you could stay out of the U.S. for up to a year, making sure to return before the expiration date on your document.
Just be careful about what you might miss while you're away. USCIS will call you in for biometrics (fingerprint and photo) within a few months after you submit the adjustment application, and for an interview at a local office several weeks or months after that (the exact timing depends on how backed up with other applications your local USCIS office is).
If you miss one of these appointments without asking for a postponement, you could put your entire application at risk. And even postponing such appointments can delay the process by a long time. You'd be wise to check into the processing times at your local USCIS office before you make travel plans; or consult with an immigration attorney for personalized advice and information on local USCIS practices and normal timing.