Density is just one aspect. How that density is designed/constructed, the nature of public space... those play a role as well.
But, by far, it's the culture and system of government. Singapore is basically a benevolent dictatorship with a very community minded, live by rule of law society. They have invested in the best access to healthcare/medicine, technologies. When the gov't makes an edict, folks OBEY. They are forward thinking, planning oriented, execution and follow through are great.
In essence, very well situated for a crisis like this... as opposed to our system of gov't and society that is not, at all, prepared (in addition to the structural issues such as lack of living wages, lack of savings/high debt, a terrible healthcare system for those without significant money and/or employer provided care.