"I have determined that it is the right time for me to step aside", Nielsen wrote in her resignation letter. Her time overseeing the sprawling department included conflict with Trump and overseeing a policy of separating children from their immigrant parents at the border with Mexico.
But Trump has said he is frustrated with the situation along the US border with Mexico and analysts say he believes Nielsen has not been strong enough in curbing the flow of migrants trying to enter the U.S.
In June past year, a judge had ordered that separations under most circumstances would not be permitted and that separated children had to be reunited with their parents.
The announcement she is leaving her post comes the day after the president visited the southern border.
On Friday, the White House announced it was withdrawing the nomination of Ronald Vitiello to lead Immigration and Customs Enforcement (ICE).
The personnel shake-ups were seen by observers as a signal the president wants to tack an even harder line.
Trump was so frustrated about the increase that he announced he would cut off US aid to Guatemala, Honduras and El Salvador.
But in recent weeks, as a new wave of migration has taxed resources along the border and as Trump sought to regain control of the issue for his 2020 re-election campaign, tensions flared anew.
CBS News reports that Nielsen's possible resignation is just one of several expected in a "a massive DHS overhaul" created to take the Department of Homeland Security in a "tougher direction", more in line with Trump's campaign rhetoric.
La secretaria de Seguridad Nacional, Kirstjen Nielsen, en el escenario para hablar se sube al escenario mientras es presentada para hablar en la convención de la Asociación Nacional de Jefes de Policía en Nueva Orleans, el lunes 18 de junio de 2018.
Before she was nominated as secretary, Nielsen worked as a deputy to former Marine General John Kelly, who headed DHS before becoming White House chief of staff.
But by October she was back at DHS, this time as secretary.
After growing public outcry, Trump ended the policy in June.
Nielsen, though, bristled at suggestions the children were being mistreated, or placed into what appeared to be "cages".
She said that she did "imagine that is the case".
Democrats have long called for Nielsen's resignation, albeit for different reasons. "Once it becomes clear that Stephen's policies aren't working, he tells the president 'they're not the right people'".
Despite reports Trump complained constantly about Nielsen performance - and that he believed she was not harsh enough - she remained a loyalist. Nielsen did not fight nor grovel to keep her job, the source said.
The President confirmed the news in a tweet later the same evening, and thanked her for her 16 months of service.