New South Wales police said 700 sought medical help for drug-related issues at Sydney's Defqon. 1 and three people are in a critical condition.
State premier Gladys Berejiklian called the annual event unsafe and said it should not take place again.
Organisers Q-Dance Australia said they are cooperating with the authorities.
The two dead have not been named but they were both in their 20s and died in hospital after collapsing, according to police.
"I'm absolutely aghast at what has occurred..." Ms Berejiklian said in a statement. "This is an unsafe event and I'll be doing everything I can to make sure it never happens again."
Police said 10 people have been charged with drug offences, including two teenagers who allegedly carried 120 tablets to the event.
The Defqon 1 festival, held at the Sydney International Regatta Centre, plays mostly hardcore techno, house and trance music.
There have been two other deaths at the festival in recent years. The event has been running since 2009.
"We do everything we possibly can to make these events safe. What we can't do is be in people's heads, be in people's decision-making processes when they decide to take illicit drugs," said Assistant Police Commissioner Allan Sicard.
More about: