The World Federation One Stop Fiqh

Ruling 1754

If a muʿtakif] leaves the mosque due to forgetfulness, his iʿtikāf becomes invalid. If a muʿtakif leaves the mosque because he was compelled or forced to leave, his iʿtikāf does not become invalid unless he stays outside for a long time such that the form of iʿtikāf is lost, in which case his iʿtikāf becomes invalid.