Counting cards in blackjack isn't illegal, however, any casino has the right to refuse service to you if they discover that you're counting cards. No one has been arrested for counting cards, but there have been players that were banned from online casinos for using this tactic.