Long slender elastic structures, such as railroad tracks, pipelines, and pavements, may experience buckling owing to axial compressive forces developed in them as a result of thermal or other effects, and in many cases these structures can be simplified as a beam on an elastic foundation. This paper presents an investigation of the critical buckling and postbuckling of such an elastic structure on a nonlinear foundation that has softening and restabilizing effects. The method of minimization of the total potential energy of the beam-foundation system is invoked to develop a differential equation of equilibrium and a differential equation of critical buckling (or bifurcation) of the beam. The analysis shows that critical buckling may be in a symmetric or in an antisymmetric mode, depending on the length of the beam, and when the length is extremely large, the two buckling modes are indistinguishable. The equations of the postbuckling equilibrium of the beam are highly nonlinear. To elucidate the response of the beam, a multiple-scale perturbation technique as used in modal analysis and a numerical solution based on a shooting technique are developed. It is shown that the postbuckling equilibrium of the beam has two stages after its critical buckling: a postbuckling localization stage that is unstable, and a subsequent postbuckling snaking stage characterized by a zigzag of the equilibrium configuration, and this snaking stage is dependent on the relative effects of the softening and restabilizing parameters. Comparisons of the perturbation solutions with the results of the numerical formulation show that the former semianalytical technique is accurate in the initial stages of postbuckling during which localization develops, but not in the subsequent snaking stage. The effect of the foundation parameters is also investigated in the paper. (C) 2017 American Society of Civil Engineers.