The statement is rather vague. Spending since when? Which expenditures count (cost for wars, cost for foreign aid, ...)? What counts as the middle east? And of course it doesn't factor in any potential benefits to the US.
That being said, I could find no source for the 7 trillion number. But Trump did make a similar claim last year (back then it was 6 trillion).
Politifact ruled that claim half-true. They name multiple studies which put the cost anywhere from 1.6 trillion to 6 trillion. But the higher estimates include money that is going to be spend in the coming decades on medical care for veterans, etc. The time frames on the estimates are also slightly different (all start in 2001 though), and they also differ in which wars they take into account.
Trump is citing the high-end estimate of credible analyses of spending associated with the wars in Iraq and Afghanistan. Yet he is confusing money that’s been spent with money that researchers say will be spent.
The DoD estimates that wars in the middle east since 2001 only cost 1.5 trillion.
According to checkyourfact.com, the White House provided a study which names 4.4 trillion (as well as 5.6 trillion until 2056 including medical costs and 7.9 trillion including interest) to back up the claim. The study has the sub-title of "A Summary of the $5. 6 Trillion in Costs for the US Wars in Iraq, Syria, Afghanistan and Pakistan, and Post-9/11 Veterans Care and Homeland Security", which summarize the results pretty well.