sed allows several syntax delimiters, / being only the one most commonly used.
You can just as well say
sed -i 's,<string>,<some/directory>,g' file.txt
where the , now has the function usually performed by the /, thereby freeing the latter from its special meaning.
Note, however (as pointed out by @Jeff Schaller), that now the , must not appear in the file or directory name - and it is a valid character for filenames! This answer gives a good overview on how to proceed when applying sed to a string with special characters.
/are the tilde~, plus sign+and equals sign=. Don't think I've ever used a comma,or octothorp#– dave58 Sep 14 '20 at 02:02