Eligibility for different travel insurance policies can vary. Most people traveling from the US can buy a policy online with guaranteed acceptance, no medical exam, no waiting; just print it out and go.
Foreign citizens may experience more limitations on policies that will cover them in the US, but usually there is some level of coverage they can get.
The insurance companies can issue insurance coverage easily because of their underwriting policies. They tend to issue policies based on some basic information, and depend on sound underwriting to cover their costs. If a claim is submitted, they will investigate to confirm that the condition was not pre-existing. They can obtain medical records and other information to confirm or deny pre-existing conditions.