After you have received permanent residency from the Green Card Lottery process, you will be allowed to work and live in the United States indefinitely. This is the great advantage of the Green Card.
However, there are some situations where your Green Card can either be revoked or your permanent residency considered to be abandoned.
Your permanent residency may be considered abandoned if you leave the country for any period of time if it is determined that you no longer wish to live in the United States. This means if you leave the country and pick up a more or less permanent job, you might be considered to be abandoning your Green Card.
You could potentially work outside of the United States temporarily, but it would be incredibly important to file for re-entry visas and to work closely with the USCIS to ensure that it doesn’t seem like you are leaving the country forever.
Even with a re-entry visa, the government may decide that you have left the country and revoke your right to permanent residency.
Really, the best way to make sure that you keep your Green Card is to live and work in the United States for several years. Then, you can apply for citizenship.
Citizenship cannot be revoked, unless it was issued fraudulently, and with full U.S. citizenship, you can travel anywhere in the world for as long as you like and you will always be re-admitted into the United States.
Other things that may let your Green Card lapse and which you should therefore avoid are if you commit any serious crimes, or if you fail to file income tax returns while abroad.