Too many games that fit into that. Might & Magic is really like that. But it could also be one of the Wizardry games. Or even one of those Das Schwarze Auge games like Realms of Arkania.
I guess to tell more exactly it would be nice to know how the battle system was like. Wizardry has random encounters. Might & Magic has monsters walking around in a turn-based manner. DSA games have a top-down TRPG battle system.
Also if you remember any spell name that would help too. Wizardry for example has so unique spell names that it's easy to recognize it's a Wizardry game just from a single spell name.
I can't think what it could be so have an incomplete list of games like that, some are for consoles.
Ultima Underworld I, II
Lands of Lore I, II
TES: Daggerfall, Arena, Battlespire, Redguard
Might and Magic series
Ishar 1, 2
Realms of Arkania 1, 2 and 3
Anvil of Dawn
Betrayal at Krondor
Shining in the Darkness
Eye of the Beholder I, II, III
Dungeon Master (think there are about 5 of these)
Wizards & Warriors
The Dark Spire
Amulets & Armor