In the US, hospitals and other emergency facilities are bound by the EMTALA law, which basically says that if someone is brought in the door and needs emergency care or is in active labor, the facility is required to provide it. Once the patient is stabilized, there may be a transfer to another facility that may be better equipped for charity care (most areas have a hospital that gets tax funding for this purpose). However it is more likely that they patient will remain where they are and the hospital staff will try to get them signed up for Medicaid or an exchange plan, which can be done retroactively.
As for the “who pays” question, it will likely be Medicaid. In the rare case that the patient can’t be enrolled, the hospital will eat the costs, which are spread out to other patients, or paid for thorough tax funds.