AbstractThis article investigates the influence of foundation and soil flexibility on the topology optimization of piled structures. The structure is modeled with classical finite elements, while the embedded pile group foundation and its interaction with the soil are modeled via the stiffness matrix method. Coupling between the structure and its foundation is obtained by establishing direct continuity and equilibrium conditions at their interface. Topology optimization of the discretized piled structure is performed through the Bi‐directional Evolutionary Structural Optimization (BESO) method for various boundary conditions. The objective function of the optimization problem is the minimization of the compliance of the piled structure under prescribed volume restriction. The results show that the flexibility of the soil and piles may have a significant effect on the optimal topology of the structure, as well as on the achievable optimization objective.