sort of, 4 times. all a long time ago. all of them really aren't exactly what was meant by the OP
I honestly am not sure about the order
1. did a course in being a pow for a week. being abused and interigated and so on
2. spent 3 weeks in military prison - more or less what happened was one of my collegues did something that pissed off a military policeman, which lead to a foot chase by a few MPs that ended up running into a group of us, who proceeded to beat on the MPs. because MPs are big mean guys, we thought that using a few magazines as clubs would be a good idea. the prison wasn't too bad, just boring. I didn't loose rank, get kicked out of my unit or have to do any labor while in jail.
3. spent a short amount of time, off and on, in prisons where terrorists and suspected terrorists were being kept.
4. once, when I was in civillian clothes and unshaven and carrying my service weapon, I was stopped by some cops and asked for my gun liscense. I didn't have my id with me, which was stupid, so they asked me to come with them to the nearest jail. I didn't give up my weapon, but I went with them until we could straighten it out. so it was pretty funny, me sitting in an unlocked lock up cell, with a riffle and two magazines, in a small police station with a bunch of cops armed with wwii era 38's.
none of the experiences were particularly exciting or bad.