A página de manual para sed (1) escreve
/regexp/Match lines matching the regular expressionregexp.
\cregexpcMatch lines matching the regular expressionregexp. Thecmay be any character.
Você pode substituir /regexp/ por \#regexp# ou, no seu caso específico:
sed -i '\#</IfModule>#i TEST' security2.conf
Pessoalmente, eu testaria sem -i até ter certeza de que estava certo.