If you are seeking a green card, and eventually U.S. citizenship, based on marriage to a U.S. citizen or permanent resident, one of the most important requirements is that the marriage be bona fide -- that is, not a sham to get a green card. The fact that you separate doesn't automatically cause the immigration authorities to believe that you have entered into a sham or fraudulent marriage. But the separation can, depending on timing, make getting a green card difficult, as described below.
We're assuming here that the separation is an actual court ordered or otherwise written agreement in which you and your spouse have decided to live separately and apart. Simply living in two different places, for other reasons than to put your marriage on hold, is not considered a separation, and should not affect your immigration status -- although it will make it harder to convince the immigration authorities that your marriage is the real thing.
Obtaining a green card through marriage to a U.S. citizen or lawful permanent resident is a multi-step process, which takes several years to complete. First, the U.S. citizen or resident must file a visa petition on your behalf (Form I-130). If your U.S. spouse is a permanent resident (not a citizen), you wait, usually for up to five years, for a visa to become available. (There's a waiting list, due to annual limits in this category.)
Next (or at the same time as the I-130 if you're already legally in the U.S. or for some other reason eligible to adjust status), you file your own application for a green card. As the final step in that application process, you attend an interview at a U.S. consulate or (if you're adjusting status) at a U.S. office of U.S. Citizenship and Immigration Services (USCIS).
You are granted U.S. residence either at your adjustment of status interview or, following your receipt of a nonimmigrant visa from an overseas U.S. consulate, upon entering the United States. If, however, your marriage is less than two years old at this time, you are not granted permanent residence yet. Instead, you receive conditional residence, which expires after two years. Within the 90 days before the expiration date, you and your U.S. spouse must file a joint petition asking that the conditions be removed and that you be granted permanent residence (which doesn't expire, although you have to get a new card every ten years).
You can file for U.S. citizenship (naturalization) after having had the green card for five years if your spouse is a permanent resident, or three years if your spouse is a U.S. citizen and you've been both married and living together all that time.
The farther you've gotten in your quest for a green card, the better your ability to overcome a legal separation. Here's what usually happens:
If you have separated and are hoping to obtain a U.S. green card through your marriage, you'll absolutely want to get a personal analysis of your situation from an experienced U.S. immigration attorney.