Adding the appropriate amount of silica fume (SF) or nanosilica (NS) can improve the strength and reduce the shrinkage of foam concrete (FC), thereby widening its application. This paper reports on a study of FC mechanical and shrinkage properties when varying SF and NS proportions were used to replace cement. Scanning electron microscopy (SEM) and nonmetallic ultrasonic detection were employed to investigate the mechanism of strength changes. The result showed that when the SF and NS content was 15% and 4%, in the 28 days, the compressive strength of FC peaked at 32.8 MPa and 35.8 MPa, and the flexural strength maximized at 7.9 MPa and 9.1 MPa, respectively. The autogenous shrinkage reached the minimum value, separately, i.e., 741.2 × 10−6 and 797.1 × 10−6. The dry shrinkage value was the highest (862.5 × 10−6 and 1387.5 × 10−6). The results indicated that the compressive and flexural strength of FC first increased and then decreased as SF and NS content increased. Autogenous shrinkage first decreased and then increased with the increase of SF or NS content. An opposite trend of dry shrinkage could be observed. FC made with NS had higher shrinkage than it did with SF. The results also indicated that there was a correlation between microstructure and sound velocity in the presence of SF or NS.