As you can see on the screenshot attached, the gemslot does not grow to allow the gem to be fitted, and when I still try to drag’n’drop it, I get a message saying it’s incompatible.
Your rapier most likely has a perk on it that already makes it deal elemental damage, such as a “fire chain” that causes an effect to jump to an additional target. In that case you may only fit gems to the weapon that match the element type it already has.