This comes after the Austrian government agreed on the details of emergency regulations - the so-called Notverordnung - that it plans to introduce once it feels that the number of asylum seekers entering Austria becomes more than it can cope with.
The regulations would allow the government to stop asylum seekers on its border and send them back to the country they travelled through.
Austria has repeatedly accused Hungary of letting migrants enter its territory despite EU rules that asylum seekers must stay in the first country they enter in the bloc. But Hungary insists that most refugees enter its territory from other EU states, mainly Italy and Greece.
Speaking to ORF radio Austria's Interior Minister Wolfgang Sobotka said that "states or groups of states that permanently break the law have to expect legal consequences". He added that if Hungary refuses to cooperate then Austria “must sue… the republic must see that the European Union acts according to the law, full stop".
Earlier this month both Austria and Hungary said the migrant situation is broadly under control, although Austria has set an annual cap on the number of asylum requests it accepts - a total of 37,500 for this year.
At present it doesn't look like this will be reached until November or December. However, Sobotka is keen that the emergency regulations be introduced as soon as possible, saying that “waiting to buy a fire engine until you have a massive blaze doesn't make sense”.
In a statement, a Hungarian government spokesman dismissed Sobotka's threat of legal action, saying the vast majority of migrants arrived in other EU states first and that Hungary “will not take responsibility for, and suffer the consequences of, the irresponsible conduct of other member states - Austria, Germany - which expressly suggested ignoring the rules”.
Last summer, Germany and Austria initially welcomed large numbers of refugees from Syria, Iraq and Afghanistan. However, Vienna started to toughen its asylum rules earlier this year - as opinion polls showed Austria's far-right Freedom Party surging ahead of the ruling centrist parties, mainly due to fears about rising immigration.