Aleksandar Vucic said the four-metre (13ft) fence was "not the solution" to migrants entering Hungary from Serbia.
Hungarian authorities announced the plan on Wednesday, saying the wall would run the length of the 175km (109-mile) border between the countries.
Foreign Minister Peter Szijjarto said Hungary could not wait for the EU to find a solution to immigration.
Speaking on TV during a visit to Oslo, Mr Vucic said: "I am surprised and shocked. We will discuss this decision with our Hungarian colleagues.
"Building walls is not the solution. Serbia can't be responsible for the situation created by the migrants, we are just a transit country. Is Serbia responsible for the crisis in Syria?"
Mr Vucic said he intended to discuss the move with Serbia's partners in the EU.
There was also criticism from the Council of Europe's Human Rights Commissioner Nils Muiznieks, who described the planned fence as "ill-advised."
There has been a sharp rise in the number of migrants and asylum seekers entering Hungary in 2015.
The government said about 54,000 migrants entered the country so far this year, compared to 43,000 people in 2014.
Police registered 10,000 people illegally going over the border in January alone.
However, tens of thousands of Hungarians have also been leaving the country.
Kosovo citizens are by far the largest group of asylum seekers in Hungary, data from the EU's Eurostat agency shows.
In January-March 2015 Hungary had 32,810 new asylum applicants, 22,830 of them from Kosovo. Hungary had the second-highest number of applicants in the EU after Germany, which had 73,120.
Kosovo asylum seekers are often treated as economic migrants fleeing poverty, rather than as genuine refugees.
"Immigration is one of the most serious problems facing the European Union today," Mr Szijjarto told a news conference on Wednesday.
"We are talking about a stretch of border 175km long, whose physical closure can happen with a four-metre high fence. The interior minister received an instruction to prepare that."
Mr Szijjarto said that the fence will not contravene any of Hungary's international obligations and that the plan will be prepared by next week.
Critics say the announcement is the latest anti-immigrant rhetoric from the Hungarian government.
A recent government billboard campaign with messages such as "If you come to Hungary, don't take the jobs of Hungarians!" has caused controversy - and prompted the UN to prepare its own billboards highlighting refugees who have successfully integrated into Hungarian society.
The poster campaign is part of the government's efforts to win public support for tough new immigration laws that are expected soon.
Hungarian officials have said that the billboards were part of a voter survey on immigration that was sent to eight million Hungarians.
The immigration questionnaire asked people whether they agreed that immigrants endangered their livelihoods and spread terrorism.
Serbia's prime minister has said he is "shocked" by Hungary's plan to erect a border fence to keep out migrants.