A medical foam for delivering an active agent to a patient includes a biocompatible composition configured to form a foam, an active agent dissolved, dispersed, or suspended in the biocompatible composition, and a gas including nitrous oxide. The biocompatible composition may be configured to form a gel at a temperature of about 37° C. A method for administering an active agent to a patient includes preparing a mixture comprising a foamable liquid and the active agent, incorporating a gas comprising nitrous oxide into the mixture to create a foam containing the active agent, introducing the foam into a body cavity of the patient, and contacting the foam with a tissue surface in the body cavity.