Sally Yates, who was appointed by Mr Trump's predecessor, Barack Obama, said she was not "convinced that the executive order is lawful".
The president's ban on nationals from seven Muslim-majority countries sparked street protests in the US and abroad.
Hundreds of US diplomats have also drafted a "dissent cable" to formally criticise the order.
The cable says that the immigration restrictions will not make the US safer, are un-American and will send the wrong message to the Muslim world, according to a draft seen by the BBC.
The ban bars citizens from Iraq, Syria, Iran, Libya, Somalia, Sudan and Yemen.
Court orders blocking aspects of the order were also made in several states over the weekend.
'Stand for what is right'
Ms Yates is due to be replaced by Mr Trump's nominee, Jeff Sessions.
In a letter to employees published by US media, she noted that the order had been challenged in court in a number of jurisdictions.
"My responsibility is to ensure that the position of the Department of Justice is not only legally defensible, but is informed by our best view of what the law is," she wrote.
"I am responsible for ensuring that the positions we take in court remain consistent with this institution's solemn obligation to always seek justice and stand for what is right."
Ms Yates was the deputy attorney general under Loretta Lynch, when President Obama was in office. She became the acting attorney general once Ms Lynch left the position.
President Trump asked her to remain as head of the justice department in an acting capacity until his nominee was formally appointed.
He also has the authority to remove Ms Yates from her post.
Senator Jeff Sessions is awaiting confirmation from the Senate to take up the position.
Ms Yates's remarks follow comments from ex-President Barack Obama that he was "heartened" by the level of engagement taking place across the country.
"Citizens exercising their constitutional right to assemble, organise and have their voices heard by their elected officials is exactly what we expect to see when American values are at stake," he said in a statement.
By convention, former presidents tend to leave the political fray and avoid commenting on their successors.
However, Mr Obama had earlier said that he might speak out after leaving office if he felt Mr Trump was threatening core American values.