This paper presents the novel development of a shape memory polymer foam based on polymer–polymer nanocomposites. Herein, polylactide (PLA)/biosourced polyamide (PA) foams are fabricated by in situ fibrillation of polymer blends and a subsequent supercritical CO2 foaming technique. In this system, PLA serves as a shape memory polymer to endow this foam with a shape memory effect (SME), and in situ generated PA nanofibers are employed to reinforce the PLA cell walls and provide an additional permanent phase. A concentration of PA, 5 wt.%, was chosen to form an entangled nanofibrillar network. Foams of PLA/PA nanoblends with the same content of constituents were fabricated to reveal the effect of minor phase morphology on the cell structure and shape memory behavior of polymer foams. Profiting from the reinforcing effect of PA nanofibers, the PLA/PA nanocomposite foam exhibits smaller foam cells, a narrower cell size distribution and a comparable cell concentration than the PLA/PA nanoblend foam. In addition, PA nanofibers, unlike PA nanodroplets, favor the shape fixation ratio and recovery ratio and shorten the shape recovery time.