Marine ecosystems reflect the physical structure of their environment and the biological processes they carry out. This leads to spatial heterogeneity and temporal variability, some of which is imposed externally and some of which emerges from the ecological mechanisms themselves. The main focus of this thesis is on the formation of spatial patterns in the distribution of zooplankton arising from social interactions between individuals. In the Southern Ocean, krill often assemble in swarms and schools, the dynamics of which have important ecological consequences. Mathematical and numerical models are employed to study the interplay of biological and physical processes that contribute to the observed patchiness.The evolution of social behavior is simulated in a theoretical framework that includes zooplankton population dynamics, swimming behavior, and some aspects of the variability inherent to fluid environments. First, I formulate a model of resource utilization by a stage-structured predator population with density-dependent reproduction. Second, I incorporate the predator-prey dynamics into a spatially-explicit model, in which aggregations develop spontaneously as a result of linear instability of the uniform distribution. In this idealized ecosystem, benefits related to the local abundance of mates are offset by the cost of having to share resources with other group members. Third, I derive a weakly nonlinear approximation for the steady-state distributions of predator and prey biomass that captures the spatial patterns driven by social tendencies. Fourth, I simulate the schooling behavior of zooplankton in a variable environment; when turbulent flows generate patchiness in the resource field, schools can forage more efficiently than individuals. Taken together, these chapters demonstrate that aggregation/ schooling can indeed be the favored behavior when (i) reproduction (or other survival measures) increases with density in part of the range and (ii) mixing of prey into patches is rapid enough to offset the depletion. In the final two chapters, I consider sources of temporal variability in marine ecosystems. External perturbations amplified by nonlinear ecological interactions induce transient excursions away from equilibrium; in predator-prey dynamics the amplitude and duration of these transients are controlled by biological processes such as growth and mortality. In the Southern Ocean, large-scale winds associated with ENSO and the Southern Annular Mode cause convective mixing, which in turn drives air-sea fluxes of carbon dioxide and oxygen. Whether driven by stochastic fluctuations or by climatic phenomena, variability of the biogeochemical/physical environment has implications for ecosystem dynamics.