Has the USA ever had a General or Admiral taken prisoner by a foreign nation? If so, how did they happen to be taken prisoner, and what was their treatment like?
No 4 star officers, so a full General or Admiral have ever been made prisoner/ But there have been instances of other senior flag officers who elected to or were forced to surrender.
During the retreat across New Jersey in 1776 Major General Charles Lee was captured. Lee was one of Washington's senior subordinates, but also chief critic. He would later return to service after being exchanged but lose his position for good after an explosive confrontation with Washington on the battlefield at Monmouth. Later in the war would see another Continental Major General surrender when Benjamin Lincoln was forced to surrender the city of Charleston.
However the event that turned the highest number of US flag officers into enemy hands was the Fall of the Philippines in 1942. While MacArthur was spirited away, the majority of his subordinates were not and were given the distasteful task of preventing a massacre or accepting the inevitable. The eventual imprisonment of nearly 100k American and Filipino troops marks the largest surrender in US history. The senior officer being LTGEN Wainwright, with MGEN's Sharp, King, Moore, MGEN Howard USMC, and BGEN McBride were all among those who surrendered. Often for their higher status these men might be singled out in the already singularly cruel IJA POW system for either mistreatment, abuse, or humiliation as well. Though all but McBride survived the war, and were singularly honored for their sacrifice and service in an impossible situation, though many had apparently expected to be punished or face a Court Martial over their decisions to surrender in the face of orders not to.