"I'm not in agreement with the philosophy of the government and the way the country is run," he told journalists, adding that his resignation would take effect on Saturday.
"When I'm not in agreement, I quit," he added, at his offices in Reduit, in the centre of the island.
Jugnauth will be replaced by Vice President Monique Ohsan Bellepeau, who is in the same party as the prime minister.
The resignation will end the two politicians' row which erupted when the leader of the opposition in parliament, Paul Berenger, announced earlier this month the creation of a new opposition alliance headed by Jugnauth.
Ramgoolam asked the president, who turned 82 this week and whose role is largely ceremonial, to either confirm or deny the statement by the opposition, and, in the case of confirmation, to resign.
There was no immediate reaction to the resignation Friday from Ramgoolam, who was attending a cabinet meeting.
Ramgoolam, who came to power in 2010 elections, still has a majority in parliament.
Jugnauth is the founder of the Mauritius Socialist Movement (MSM), a party currently headed by his son Pravind Jugnauth, who quit government last year along with several MSM ministers and members of parliament over a corruption scandal.
The politicians who quit went over to the opposition and ended up forming an alliance with the Mauritius Militant Movement (MMM) headed by Paul Berenger.
Anerood Jugnauth will now head the MMM-MSM alliance.
Jugnauth has been in politics since 1963, head of the parliamentary opposition from 1976 to 1982, then serving as prime minister from 1982 to 1995 and again from 2000 to 2003. He has held the post of president since 2003. His second five-year term was due to expire in 2013.
In 2002, the then president Cassam Uteem quit because he disagreed with a draft bill on fighting terrorism.
Under the Mauritius constitution, the president can send a bill back to parliament once with modifications. The second time he is obliged to either promulgate the law or resign.
The country, an archipelago of four islands, is officially divided into four ethnic groups: Hindus, Muslims, Chinese, and the remaining "general population". It has nearly always had a prime minister from the Hindu majority.
Since independence from Britain in 1968, Mauritius has been considered a stable democracy and has sustained economic growth to make its 1.2 million inhabitants among the richest in Africa.