There is a foramen ovale (oval hole) between the right and left atrium in the fetus. After birth, this should close. If it does not, this is an atrial septal defect (hole in the heart). In the fetus, the right atrium pumps blood into the left atrium, bypassing the pulmonary circulation (which is useless in a fetus). In an adult, a septal defect would result in flow in the reverse direction - from the left atrium to the right - which will reduce cardiac output, potentially cause cardiac failure and in severe or untreated cases, death.
Many other animals, including mammals, also have four-chambered hearts, and have a left atrium. The function in these animals is similar. Some animals (amphibians, reptiles) have a three-chambered heart, in which the blood from each atrium is mixed in the single ventricle before being pumped to the aorta. In these animals, the left atrium still serves the purpose of collecting blood from pulmonary veins.