A tourist visa card (visa de tarjeta del turista) is necessary for
travellers from most nations. This visa, which is really little more
than a piece of paper on which you list your vital statistics, costs
between 15-25 CUC (or 15-25 Euro), depending on where purchased. It
can be purchased at the Airport in Cuba on arrival, however it should
be noted that many airlines will require a valid tourist visa card
before boarding flights. It is usually valid for 30 days and can be
extended once for another 30 days at any immigration office in Cuba
(for 25 CUC) - beyond this you would need a flight out of Cuba within
the extended visa period. Canadians are the exception, getting 90 days
on arrival and can apply for a 90 day extension. Your passport needs
to be valid at least six months past the end of your planned return.
But that some countries don't need it:
Citizens of Antigua and Barbuda (28 days), Barbados (28 days), Benin,
Bosnia and Herzegovina, CIS (except Ukraine and Uzbekistan), Dominica,
Grenada (60 days), Liechtenstein (90 days), Macedonia, Malaysia (90
days), Mongolia, Montenegro (90 days), Namibia, Singapore, Slovakia,
Saint Kitts and Nevis, Saint Lucia, Saint Vincent and the Grenadines,
Serbia (90 days), Turkmenistan who can stay 30 days without visa.
It's also worth noting that it's different if you're an American citizen....with more details on the same Wikivoyage link.