The attacked happened in Larne, Co Antrim around lunchtime on Friday.
The victim, who is in his 20s, was attacked at Shanlea Drive at around 12.40 pm.
His injuries are not believed to be life-threatening at this stage.
The two men, aged 28 and 33, who were arrested about an hour after the attack was reported, have been released on police bail,
Police have appealed for witnesses to contact them.
Chief Inspector Stephen McCauley, police commander for Larne, said: “Our officers were called to the area following an attack on a man at around 12:40pm on Friday afternoon.
“The man is reported to have been beaten with baseball bats and sustained serious head injuries as a result. The man, aged in his 20s, has been taken to hospital for treatment. At this point in time, his injuries are not thought to be life threatening.
“Police officers arrested two men in the Larne area around one hour after the attack was reported. Both men were arrested on suspicion of attempted murder.
“Anyone with information on the matter is asked to call detectives on the non-emergency 101 number.
“Or, if someone would prefer to provide information without giving their details, they can contact the independent charity Crimestoppers and speak to them anonymously on 0800 555 111.”