The government managed Unified Health System (Sistema Único de Saúde, known as SUS) provides a broad range of free health care which can be accessed without registration by any legally situated person in Brazil, including foreign residents.
The SUS covers doctor's and laboratory fees, hospital accommodation, surgeries, drugs and an excellent primary care for families in poor areas.
The introduction of this universal health care system goes back to 1988. Up to that point health insurance in Brazil could only be accessed in combination with employment, thus leaving a large number of Brazilians without medical care. In order to provide justice and equality, the government introduced the new system which is funded by numerous governmental subsystems.
However, in spite of the numerous sources that finance the health care system, the budget does not suffice to cover the increasing expenditures. This results in poor hospital conditions and medical equipment, staff shortage and long waiting lists for surgery and other services. For this reason, public health care is mainly used by the poorer part of the population whereas everybody who can afford it opts for private health cover.
As a foreigner in Brazil you should definitely consider an additional private health plan or health insurance if you don't want to run the risk of having to rely on a public medical treatment that can turn into a nightmare – especially if you become seriously ill.