The move to file charges against the men jeopardises “easy wins” in the mid-term elections, Mr Trump tweeted.
One is accused of insider trading and the other of campaign violations.
The tweet has sparked fresh criticism that Mr Trump is illegally seeking to interfere with the justice system.
It is highly unusual for sitting presidents to lash out against attorneys general and to try to bring political considerations to bear on prosecution decisions.
What is the latest controversy about?
It comes ahead of the mid-term elections on 6 November. The Democrats are seeking to wrest control of the House of Representatives from the Republicans.
Last month Representative Christopher Collins was charged with participating in an insider trading scheme. He has denied wrongdoing but said he would not seek re-election.
Later in August Representative Duncan Hunter and his wife were indicted for allegedly using campaign funds to pay for personal expenses. They too deny the charges.
Both men were early supporters of Mr Trump when he launched his bid for the presidency and was facing hostility from Republican congressional leaders.
In a tweet, Mr Trump criticised the prosecution of “two very popular Republican Congressmen”.
Two long running, Obama era, investigations of two very popular Republican Congressmen were brought to a well publicized charge, just ahead of the Mid-Terms, by the Jeff Sessions Justice Department. Two easy wins now in doubt because there is not enough time. Good job Jeff……
— Donald J. Trump (@realDonaldTrump) September 3, 2018
The investigation into Mr Hunter began under the presidency of Barack Obama, but the Collins inquiry was launched last year.
What has the reaction been?
The justice department has not commented on the tweet. But it has drawn fire from a number of critics, including Mr Trump’s fellow party members.
Republican Senator Ben Sasse said the justice department should remain politically neutral in deciding whether or not to prosecute.
“The United States is not some banana republic with a two-tiered system of justice – one for the majority party and one for the minority party. These two men have been charged with crimes because of evidence, not because of who the president was when the investigations began,” he said.
US political scientist and columnist Brian Klass called Mr Trump’s outburst “insane”.
No exaggeration: if any other elected leader in a Western democracy tried to instruct their top law enforcement official to shield their political allies from prosecution for political reasons like this, they would be forced to resign within hours. This is insane. https://t.co/i8HpCpDjm0
— Brian Klaas (@brianklaas) September 4, 2018
Other critics argue that mid-term elections are not a good reason to delay prosecution.
Are you suggesting that members of Congress are above the law? The Department of Justice clearly has sufficient evidence to charge Mssrs. Collins and Hunter with felonies. The courts shall decide their guilt or innocence.
This is disgraceful.
— Steven Kleinman (@SMKleinman) September 4, 2018
What are Mr Trump’s relations with Mr Sessions?
The president has been a vocal critic of the justice department and has frequently clashed with his attorney general.
The criticism began in the early months of the administration last year, when Mr Sessions recused himself from investigations into claims that Russia tried to help Mr Trump win the 2016 election.
The attorney general, a staunch conservative and early supporter of Mr Trump’s campaign, handed control to his deputy to avoid a potential conflict of interest. Mr Trump regarded that move as a “betrayal”.
The deputy in turn appointed ex-FBI director Robert Mueller as special counsel to lead the inquiry, which the president has repeatedly called a “witch hunt”.
Mr Trump is widely believed to have lost faith in Mr Sessions.
In a recent interview with Bloomberg, he said: “I do question what is Jeff doing.” Asked if he would retain his attorney general beyond the midterms, he declined to comment.