Scarr, 22, who starred in Stourbridge's run to this season's FA Cup third round, has signed on a two-and-a-half year contract, for an undisclosed fee.
He becomes the sixth signing made by Blues in the January transfer window.
On top of the pre-arranged completion of striker Lukas Jutkiewicz's move from Burnley, new boss Gianfranco Zola has now made five more signings.
As well as bringing back Craig Gardner from West Bromwich Albion, he last week signed Middlesbrough full-back Emilio Nsue, Cheick Keita from Italian Serie B club Virtus Entella, and winger Kerim Frei from Turkish side Besiktas.
Stourbridge boss Gary Hackett said: "We have agreed terms with Birmingham. We have accepted we won't have Dan with us moving forward and good luck to him. He deserves the opportunity."
Find all the latest football transfers on our dedicated page or visit our Premier League tracker here.
Championship side Birmingham City have signed defender Dan Scarr from non-league neighbours Stourbridge.