The history of playing card symbols in warfare is a fascinating one that goes back at least as far as World War I, where it was used to distinguish specific units (regiments, battalions) within larger units. The British 47th Division (1/2 London), for example, used a series of playing card insignia in various colors. Chappell's 1986 British Battle Insignia: 1914-1918 mentions this, as does his The British Army in World War I: The Western Front 1916-18.
One of the better-known uses, however, comes from the French tank corps during the war. The French formed their tank corps from the artillery service, and the first tankers were known as Artillerie Speciale. Until September 1917, they had no official branch badge, and so they tended to invent their own. One of the most popular was a play on the initials AS ─ which is also the French word for ace. These badges would include AS and a playing card symbol representing a different battery: spade for the first, heart for the second, diamond for the third, and club for the fourth. The French Army 1914-18 by Osprey Publishing goes into this, as does Zaloga's French Tanks of World War I. You can also see the French symbols on display aboard destroyed tanks in this video.
American units picked up the habit as well. The 5th Infantry Division, for example, was formed in 1917 and was known as the Red Diamond, after its shoulder insignia. Soldiers took up the symbol, decorating their equipment with playing cards featuring it, a habit that would last into the next war.
Playing cards were ubiquitous in the trenches; they were easily portable, durable, and could be used in a variety of games. Mass manufacturing made large numbers available, and standardization of the suits and numbers ensured that the same symbols showed up again and again. In WWII, for example, the 101st Airborne used painted playing card symbols on the sides of helmets to distinguish soldiers belonging to different units (thanks to /u/loserlame for the link, and see Mark Bando's 101st Airborne for exhaustive detail on equipment).
Playing cards show up in decoration on personal gear, on nose art for aircraft and tanks in every war from World War I to the present day. In Vietnam, they started assuming a newer, grimmer role.
James McManus' Cowboys Full: The Story of Poker covers the Vietnam aspect concisely and clearly in one portion of its history of poker. In April 1965, President Johnson ─ through National Security Adviser McGeorge Bundy ─ ordered "intensified and expanded psychological activities in the Vietnamese conflict." A 22-person psychological warfare unit arrived in the country by September that year and began a leaflet campaign. It isn't clear who came up with the idea, but in late 1965 or early 1966, soldiers came up with the idea of placing a playing card on Vietnamese dead as a way to taunt the opposition.
The U.S. Air Force came up with its own technique. It sprinkled playing cards in its leaflet campaign, but when it was about to carpet bomb an area, the drop included only the ace of spades. Writing in the Village Voice at the time, Ian Urbina reported: "Before long, the Pavlovian technique took hold, and just the dropping of aces was sufficient to clear an entire area."
In early 1966, soldiers wrote the U.S. Playing Card Company, asking for decks containing nothing but the ace of spades. The company responded and used the event to its advantage, promoting it in a PR campaign. The company soon received thousands of requests from the families of servicemen interested in sending similar decks to their sons. The reports showed up in Life, Look, Newsweek, and the Huntley-Brinkley Report, to name just a few.
The ace of spades was commonly believed to be the "death card" and had a psychological impact on the Vietnamese. Whether that's true isn't exactly clear, but it showed up on American propaganda leaflets throughout the war anyway.
Even if it wasn't an effective negative psychological warfare tool, it was strongly positive for the Americans who saw it. As James Ebert's A Life in A Year: The American Infantryman in Vietnam explains, the card, tucked into a helmet band (it secured the cloth helmet cover to the helmet), became a form of sanctioned expression. Because the card was part of a psychological warfare campaign, it wasn't necessarily out of regulation to have one on your helmet. Some soldiers took the card even farther, writing messages on it.
As Ebert writes, "Men penciled in 'God is my pointman' or expressed the wish that President Johnson himself was serving in that capacity."
The idea of the card was so ingrained into the psyche of the U.S. military that the symbols reappeared in Gulf War I leaflets dropped on Iraqi soldiers and still appear from time to time on Americans' gear today.