The facilitation of biodiesel utilization in combustion systems is significant since it can be obtained from renewable sources. However, many challenges arise when it is used as the sole fuel in internal combustion engines. To address these challenges, this work examines the effects of using a porous medium in the combustion process of a biodiesel-fueled compression ignition engine with a thermodynamic model. The porous medium was located in the engine cylinder head, and the fuel was injected into it before entering the cylinder for a certain period. The model used detailed combustion mechanisms to investigate the impacts of the intake air temperature and pressure, initial gas temperature in the porous medium volume, injection timing strategies, and porous medium properties, including porosity, material, and initial temperature of the solid structure. It was found that the role of the porous medium in combustion temperature and pressure reduction depended on the initial gas temperature in the porous medium volume. The maximum temperature and pressure for the PM initial temperature of 1000 K were 1327 K and 73.2 bar, while at the initial temperature of 1300 K were 1160 K and 60.05 bar. The porous medium prominently increases the formation of nitrogen oxide (NOx) in the combustion system. NOx emissions can be controlled by selecting the porous medium with proper porosity, adjusting the combustion air properties, and setting the optimum fuel injection timing. While the NO formation at 540 crank angle degrees (CAD) was around 8.03 g/kg fuel mass for the initial PM temperature of 1000 K, it was 0.076 g/kg fuel mass for the initial temperature of 1300 K. Late fuel injection resulted in higher NO and NO2 emissions. The minimum NO and NO2 formation occurred when the fuel was injected at 348 CAD. The combustion pressure increase resulted in higher NOx emissions. The NO and NO2 formations at 540 CAD for Pi = 1 bar were 0.12 and 2.38 g/kg fuel mass; for Pi = 3 bar, they were 0.58 and 5.9 g/kg fuel mass, respectively.