To avoid fees, I think you would have to be in a promotional period with the "second card". Typically, a balance transfer is treated similar to a cash advance and interest starts accruing on day 1 - in addition to the balance transfer fee. So just make sure you read the T&C on the card that you're transferring the balance to so you'll understand (1) what fees you'll be paying and how much, therfore, the miles will be costing you and (2) verify that you'll actually earn miles on the balance transfer (again, typically only possible during a promotional period).
I just happened to be looking at the United Mileage Plus Platinum VISA card last night ($85 annual fee, 15,000 bonus miles after first use). I forget the time period, maybe the first six months, that you could earn another 10,000 bonus miles for balance transfers or convenience checks (at a rate of 1 mile for every $2.00 transferred). However, the fee on the balance transfer (or check) is 3% of the transaction amount - which seems to get pretty steep, pretty quick at $30/thousand. However, I think the T&C also said that the maximum balance transfer/check fee was $50. So, theoretically, you could get 25,000 miles for $135 ($85 annual fee earning 15,000 miles and a $20,000 balance transfer costing $50 earning 10,000 miles). The only question I have there is whether there would be a "balance transfer limit" that would keep you from doing a $20,000 balance transfer.
Of course, the easy way to do this would be to forget about balance transfer and just write a $20,000 convenience check to yourself. Deposit it in the bank and then pay off your credit card as soon as the charge posts. You'd pay the $50.00 fee, and maybe a day or 2 of interest (which is a whopping $10/day for a $20,000 balance at 18%), but nothing else. If you've got the spare cash, it might even be possible to send a check to your credit card company first to create a $20,000 credit balance in your account before the convenience check even posts - then you'll pay no interest (wouldn't it be great if the CC company would pay you 18% on that credit balance?).
I'm done rambling now.