The ex-Stoke player, 27, has been at Derby since being signed, initially on loan, by Steve McClaren in August 2014.
He was a regular in his first season at Derby but has lost his place since Paul Clement came in last summer, making just one start in seven appearances.
Shotton becomes boss Gary Rowett's fifth January signing for Blues so far.
The Championship play-off hopefuls have this week spent £1.5m on Watford midfielder Diego Fabbrini, who had been on loan at Championship leaders Middlesbrough, and they have made two other loan signings.
Sunderland winger Will Buckley signed for an initial month but has now extended his stay until the end of the season, after scoring on his home debut in last Saturday's 3-0 home win over Ipswich.
Striker James Vaughan has also extended his stay from fellow Championship side Huddersfield Town until the end of the season.
Also, teenage midfielder Luke Maxwell, 18, was signed from Kidderminster Harriers for £75,000. but was loaned back to the relegation-threatened National League club.
After a run of 13 points out of a possible 15 since Boxing Day, Rowett's men are seventh in the table, below the play-off zone on goal difference - just three points behind fifth-placed Derby, Rowett's old club.
Blues remain up for sale, but had their bank balance boosted earlier this month by the sale of Demarai Gray, who joined Premier League side Leicester City for £3.75m.
Ryan Shotton is still under contract to Derby for another season at the end of the current campaign, having been signed on a two-and-a-half-year deal following his successful loan with the Rams.
Having progressed through Stoke City's academy, Shotton spent a season on loan with non-league top flight side Altrincham before being handed his Potters debut by Tony Pulis in August 2008.
He also had loan spells at Tranmere Rovers, Barnsley and Wigan Athletic before being signed by Derby, tor whom he completed his move for an undisclosed fee in January 2015.
Find all the latest football transfers on our dedicated page.
Birmingham City have signed defender Ryan Shotton on loan until the end of the season from Championship promotion rivals Derby County.