Egg laying is an important phase of the life cycle of the nematode Caenorhabditis elegans (C. elegans). Previous studies examined egg-laying events manually. This paper presents a method for automatic detection of egg-laying onset using deformable template matching and other morphological image analysis techniques. Some behavioral changes surrounding egg-laying events are also studied. The results demonstrate that the computer vision tools and the algorithm developed here can be effectively used to study C. elegans egg-laying behaviors. The algorithm developed is an essential part of a machine-vision system for C. elegans tracking and behavioral analysis.