In most cases, a new immigrant or a recent green card holder won't qualify for Medicare insurance due to the program's specific and strict eligibility criteria. If you're a green card holder who doesn't reside in the U.S. and is just visiting America, you may be able to purchase a plan for temporary health coverage for green card holders for coverage while in the country.
If you don't qualify for Medicare, you can buy temporary health insurance which provides medical coverage for non-U.S. citizens.