The most correct opinion is that staying in Arafah until the sun sets is obligatory, because the Prophet (blessings and peace of Allah be upon him) did not leave before the sun set, and if it were permissible he would have left before the sun set, because then it is still daytime and is easier for people. Moreover, if a person leaves before the sun sets, he has forsaken the Sunnah of the Prophet (blessings and peace of Allah be upon him) for the way of the Jaahiliyyah, because the people of Jaahiliyyah are the ones who leave Arafah before the sun sets. If the one who does that does it deliberately, his action results in two things:
(ii) According to the majority of scholars, he has to offer a sacrifice as ransom (fidyah), to be slaughtered in Makkah and distributed to the poor.
But if he left Arafah before sunset out of ignorance, he has not sinned but according to the majority of scholars he has to offer a sacrifice, which means slaughtering a sheep in Makkah and distributing it (its meat) to the poor. End quote.
Reproduced from Islam QA