The Mercenary Magic Contract upgrade is part of the tier 1 Mercenary First Contract upgrade, which is only available when allied with the Mercenary faction.
It allows you to choose the first faction spell. A second spell will be available after buying the Tier 3 Mercenary Sorcery Contract.
The choice of faction spells you get depends on the alignment you are playing. (e.g. The Night Time spell is only available to the evil alignment.)