Biocompatible foams having excellent physical and chemical properties are described. The biocompatible foams can be formed in situ or applied as a pre-formed foam for the treatment of tissue. The invention provides biocompatible degradable foams formed with a poly-α(1→4)glucopyranose macromer. The invention also provides biostable foams formed with a poly(alkylene oxide) macromer.