Some of the justices including conservative Chief Justice John Roberts asked tough questions of the Justice Department lawyer defending Trump's action.
The justices were hearing the US administration's appeal of a lower court's decision that blocked his executive order directing US agencies not to recognise the citizenship of children born in the United States if neither parent is a US citizen or legal permanent resident, also called a "green card" holder.
Trump, wearing a red tie and dark suit, was sitting in the front row of the public gallery of the ornate courtroom.
Trump became the first sitting president to attend an oral argument at the Supreme Court, according to Clare Cushman, the resident historian at the Supreme Court Historical Society.
US Solicitor General D John Sauer, representing the administration, began his arguments by noting that the citizenship clause "was adopted just after the Civil War to grant citizenship to the newly freed slaves and their children, whose allegiance to the United States had been established by generations of domicile here".
It did not, he said, "grant citizenship to the children of temporary visitors or illegal aliens who have no such allegiance".
Trump's directive issued last year violated citizenship language in the US constitution's 14th amendment as well as a federal law codifying birthright citizenship rights, the lower court found, acting in a class-action lawsuit by parents and children whose citizenship is threatened by the directive.
The 14th amendment has long been interpreted as guaranteeing citizenship for babies born in the United States, with only narrow exceptions such as the children of foreign diplomats or members of an enemy occupying force.
The provision at issue, known as the Citizenship Clause, states: "All persons born or naturalised in the United States, and subject to the jurisdiction thereof, are citizens of the United States and of the state wherein they reside."
Conservative Chief Justice John Roberts told Sauer that his arguments that would limit who qualifies for citizenship at birth based on the 14th amendment language "subject to the jurisdiction thereof" seemed "quirky".
Noting that historically this phrase excluded the children of ambassadors or enemies during a hostile invasion, Roberts said Sauer is trying to expand those examples to everyone in the US illegally.
"I'm not quite sure how you can get to that big group from such tiny and sort of idiosyncratic examples," Roberts said.
Progressive Justice Sonia Sotomayor asked Sauer about historical records that shed light on the debate around the adoption of the 14th amendment and the Civil Rights Act of 1866.
Sotomayor said the congressional record makes clear that the legal theory of Trump's administration was rejected at the time those measures were adopted.
"What do we do with those debates and the fact the proponents of both acts said everyone born in the US will be citizens?" Sotomayor asked.
Sauer disputed that view of US history, saying there was a "common understanding that sojourners do not have children who become citizens".
The administration has asserted that the phrase "subject to the jurisdiction thereof" means that being born in the US is not enough for citizenship, and excludes the babies of immigrants who are in the country illegally or whose presence is lawful but temporary, such as university students or those on work visas.
Citizenship is granted only to the children of those whose "primary allegiance" is to the US, including citizens and permanent residents, the administration has argued.
The administration has said that granting citizenship to virtually anyone born on US soil has created incentives for illegal immigration and led to "birth tourism," by which foreigners travel to the United States to give birth and secure citizenship for their children.
The Supreme Court is expected to rule by the end of June.
with AP