There is a natural evolution from Turbo -> Ram it Down -> Painkiller. Ram it Down has some of the commercial sounds and sillier lyrics of Turbo (makes sense given they were intended to be a double-album) but is much heavier, and Painkiller is just expanding on that evolution.
The intensity is likely more a response to what was going on around them at the time, not so much trying to stay relevant. The changing musical landscape, Ram it Down being poorly received*, the accusations of subliminal messaging (I always thought that's what "Between the Hammer and the Anvil" was written about, though I think the trial itself was after Painkiller was recorded) and Halford's personal issues would all have weighed on the band and made them want to write a darker, heavier album.
*Depending on whether it was poorly received on release or has just been retrospectively rated badly.