The president, in an earlier tweet, weighed in on the midterm results, overlooking the Democratic pickups in the House and writing: "Tremendous success tonight".
Hannity himself had tweeted: "To be clear, I will not be on stage campaigning with the president".
The rally was held at the Show Me Center on the campus of Southeast Missouri State University. "Something I have done in every election in the past".
Trump called Rep. Nancy Pelosi and noted her pitch for bipartisanship in her remarks, her office tweeted.
But just hours later, Hannity did just that after the president invited him and Pirro to join him, calling both "very special".
"If the radical Democrats take power, they will take a wrecking ball to our economy and to the future of our country", Trump said, prompting boos from the crowd.
Resigned to losing his party's grip on the House, President Donald Trump congratulated the House Democratic leader on Tuesday night and chose to celebrate "tremendous success" for Republicans in maintaining the Senate.
He said: "By the way, all those people in the back are fake news. This was NOT planned". They indeed are fake news. "They do awesome work day in and day out in a fair and balanced way and It is an honor to work with such great professionals", he tweeted Monday. Really? You're aghast? You're aghast that Sean Hannity lied about what he was going to do?
"If the Democrats think they are going to waste Taxpayer Money investigating us at the House level, then we will likewise be forced to consider investigating them for all of the leaks of Classified Information, and much else, at the Senate level". If you like the America that he is making now, you've got to make sure you get out there tomorrow if you haven't voted yet. And now you've pissed off the people that you depend on the most.
The Trump campaign had promoted Hannity over the weekend as a "special guest" at Trump's final rally before Tuesday's midterm election.
It is unusual for journalists and on-air commentators to participate in campaign rallies.
A spokeswoman for Fox News did not immediately return a request for comment.
Widely viewed as a referendum on Trump's presidency, Tuesday's results offered a split decision that revealed deep tensions in the American electorate - distances that could easily widen during two years of divided control.
While walking onstage in Cape Girardeau on Monday, Trump high-fived Bill Shine, the White House communications director who is a former Fox News executive. Hannity described his role as that of an "advocacy journalist" during an interview in 2017.
Hannity has been rebuked by Fox in the past.
Pirro also urged voters to make their voices heard, after Trump introduced her as "Justice Jeanine". Politico reports that her name came up as a possible contender for the job of Attorney General.
Trump did not care for the soft-focus ad, which notably did not mention him, according to a person familiar with the president's thinking who was not authorized to speak publicly.