Nanoporous metals or nanofoams are a promising material class that is considered for sensing, actuation, and catalysis. To date, they mostly based on simple noble metals such as nanoporous gold, which exhibit peculiar stress-strain response different from the bulk material. At the same time bulk alloys such as NiTi feature a reversible martensitic phase transition giving rise to interesting shape memory and superelastic effects. Combining the rich mechanics of NiTi with the geometrical features of a nanofoam is expected to improve the mechanical performance of this material. In this atomistic study we explore the behavior of a NiTi nanofoam at varying temperature and its reaction to (cyclic) compression. Using molecular dynamics simulations we track the microscopic processes enabling reversible deformation as well as the mechanical failure mechanisms of the NiTi nanofoam.