Social isolation is often considered to have negative effects on cognitive function in a wide range of species. Here we assess how environmental context alters the effect of isolation on long-term memory formation (24h) in the pond snail Lymnaea stagnalis. We operantly trained snails to reduce aerial respiration in hypoxia following exposure to one of three social conditions: (1) maintained and trained in groups; (2) maintained in groups, trained in isolation; or (3) maintained and trained in isolation. In addition, snails also experienced four stress exposure levels: control, exposure to low calcium availability, predator kairomone exposure during training or a combination of low calcium and predator kairomones. Snails isolated during training alone demonstrated no difference in memory formation compared with the snails trained in groups. Maintaining snails in social isolation for 8days prior to training had a neutral effect on memory in control conditions or in the presence of predator kairomones alone. However, social isolation enhanced long-term memory formation in snails exposed to low calcium conditions, a stress that blocks memory formation in snails maintained in groups. Conversely, when exposed to low calcium and predator kairomones combined, grouped snails normally demonstrate long-term memory, but following maintenance in isolation long-term memory was blocked. Therefore, the effect of social isolation on cognitive function is highly dependent on the environmental context in which it is experienced.