This article reports on a full-atomic simulation by classical molecular dynamics, investigating the impregnation of silica-based aerogels with mefenamic acid in supercritical carbon dioxide (sc-CO2). Silica aerogel samples were modeled by a set of primary particles obtained by complete or partial condensation of tetramethylorthosilicate and vinyltrimethoxysilane. The influence of such factors as the nature of the aerogel, its type (hydrophilic and hydrophobic), and the concentration of the target compound on impregnation was estimated. Analysis of pore size distribution, atom–atom radial distribution functions, fractal dimension, and porosity allow us to conclude that the created aerogel model may be considered a model sufficiently close to the experimental sample. During the impregnation process, mefenamic acid is adsorbed onto the aerogel surface, forming hydrogen bonds with free silanol or (in the case of hydrophobic aerogel) with siloxane groups through the carbonyl oxygen atom and hydrogen atom of the carboxyl group. The silica aerogel loading is dependent on the mefenamic acid concentration in sc-CO2 bulk. With increasing acid concentration by ∼2 times, the loading increases by ∼6 times and reaches 4.66 %.