See the corresponding discussion of ‘-!’ in ‘-!’: Make ‘!’ denote short comment (FORTRAN & RATFOR) and ‘-n!’: Make ‘!’ denote short comment [FORTRAN].
In FORTRAN-77, to include the exclamation point inside a string, escape it with a backslash, as in
s = "A \! inside a string"