With Bayern having already clinched the Bundesliga title this season, Stuttgart, 12th in the league and off the European spots, are assured a place in next season's Europa League even if they lose the June 1 final in Berlin.
Three-time winners Stuttgart, who last reached the final in 2007, got the early goal they were aggressively looking for when Arthur Boka slotted home after a dazzling 40-metre run by Ibrahima Traore in the 10th minute.
Austria international Martin Harnik, who had missed a huge chance in the opening minutes, restored Stuttgart's lead with a close-range header off the bar on the half hour.
"These are special moments and that is why we do this job," said Stuttgart coach Bruno Labbadia, whose team competed in the Europa League this season but had a disastrous start to the new year.
"My team fought with everything they had. This team has gone to its limits constantly in the past 2-1/2 years and now it is being rewarded for it."
Freiburg, who are fifth in the Bundesliga and on track to qualify for European football next season, tried to come back.
But keeper Ulreich denied Max Kruse with a fine save in the visitor's only good effort in the second half as the 59,000 Stuttgart fans started celebrating and chanting "We are going to Berlin".