Many intertidal snails form aggregations during emersion to minimize desiccation stress. Here we investigate possible mechanisms for the evolution of such behavior. Two behavioral traits (following of mucus trails, and crevice occupation), which both provide selective advantages to individuals that possess the traits over individuals that do not, result in self-organization of aggregations in crevices in the rock surface. We suggest that the existence of self-organizing aggregations provides a mechanism by which aggregation behavior can evolve. The inclusion of an explicitly coded third behavior, aggregation, in a simulated population produces patterns statistically similar to those found on real rocky shores. Allowing these three behaviors to evolve using an evolutionary algorithm, however, results in aggregation behavior being selected against on shores with high crevice density. The inclusion of broadcast spawning dispersal mechanisms in the simulation, however, results in aggregation behavior evolving as predicted on shores with both high crevice density and low crevice density (evolving in crevices first, and then both in crevices and on flat rock), indicating the importance of environmental interactions in understanding evolutionary processes. We propose that self-organization can be an important factor in the evolution of group behaviors.