The fishermen had been produced before the magistrate in the northeastern town of Mannar and ordered to be in remand custody until June 16.
They were part of a group of fishermen, who set out in 727 boats from Rameswaram and while they were fishing near Katchatheevu, the Lankan Navy personnel came in four boats and arrested the 29 fishermen on May 31 night.
Katchatheevu, an islet in the Palk Straits, was ceded to Sri Lanka by India in 1974.
Presidential spokesman Mohan Samaranayake said President Rajapaksa’s order to release fishermen is to signify a goodwill gesture by him to the new Indian government.
Rajapaksa had attended the swearing in ceremony of Prime Minister Narendra Modi on May 26 in Delhi.
In a similar gesture, Rajapaksa ordered the release of all Indian fishermen in Sri Lankan custody last month.
Talks between India and Sri Lanka on the fishermen issue had ended in deadlock early last month and negotiators are scheduled to meet again this month.
Sri Lanka had shot down a request from Tamil Nadu fishermen to allow fishing in Lankan waters for 70 days a year and to allow bottom trawling.