As a result of their cell structures, elastomeric foams exhibit high compressibility and are frequently used as buffer cushions in energy absorption. Foam pads between two surfaces typically withstand uniaxial loads. In this paper, we considered the effects of porosity and cell size on the mechanical behavior of random elastomeric foams, and proposed a constitutive model based on an artificial neural network (ANN). Uniform cell size distribution was used to represent monodisperse foam. The constitutive relationship between Cauchy stress and the four input variables of axial stretch λU, lateral stretch λL, porosity φ, and cell size θ was given by con-ANN. The mechanical responses of 500 different foam structures (20% < φ < 60%, 0.1 mm < θ < 0.5 mm) under compression and tension loads (0.4 < λU< 3) were simulated, and a dataset containing 100,000 samples was constructed. We also introduced a pre-ANN to predict lateral stretch to address the issue of missing lateral strain data in practical applications. By combining physical experience, we chose appropriate input forms and activation functions to improve ANN’s extrapolation capability. The results showed that pre-ANN and con-ANN could provide reasonable predictions for λUoutside the dataset. We can obtain accurate lateral stretch and axial stress predictions from two ANNs. The porosity affects the stress and λL, while the cell size only affects the stress during foam compression.