An approach for the topology optimization of structures composed of nonlinear beam elements under time-varying excitation is presented. Central to this approach is a hysteretic beam finite element model that accounts for distributed plasticity and axial-moment interaction through appropriate hysteretic interpolation functions and yield/capacity function, respectively. Nonlinearity is represented via the hysteretic variables for curvature and axial deformations that evolve according to first order nonlinear ordinary differential equations (ODEs), referred to as evolution equations, and the yield function. Hence, the governing dynamic equilibrium equations and hysteretic evolution equations can thus be concisely presented as a system of first-order nonlinear ODEs that can be solved using general ODE solvers without the need for linearization. The approach is applied for the design of frame structures with an objective to minimize the total volume in the domain, such that the maximum displacement at specified node(s) satisfies a specified constraint (i.e., drift limit) for the given excitation. The maximum displacement is approximated using the p-norm and thus permits the completion of the analytical sensitivities required for gradient-based updating. Several numerical examples are presented to demonstrate the approach for the design of structural frames subjected to pulse, harmonic, and seismic base excitation. Topologies obtained using the suggested, nonlinear approach are compared to solutions obtained from topology optimization problems assuming linear-elastic material behavior. These comparisons show that although similarities between the designs exist, in general the nonlinear designs differ in composition and, importantly, outperform the linear designs when assessed by nonlinear dynamic analysis.