My friend told me I only get 5 seconds to say if I'm going to counter a card in Magic the Gathering, even if I tell him to wait. Is that true?
Your friend made that up. There is nothing in the comprehensive rules about how long a player may retain priority. Once you've got it, you keep it as long as you like until you play a spell/ability or pass.
If you're in an official tournament setting, your opponent can call a judge if he thinks you're intentionally playing slowly. If you're playing at your friend's kitchen table, then anything goes. Of course, the host can always decide to kick you out of his house, so try to play at a reasonable speed.
Not only is your friend wrong - "time" actually is not relevant to any part of Magic The Gathering. (Except maybe in tournament play when each session of rounds is timed)
And regardless of rules, a friend should never rush a friend, especially if asked nicely to wait.
As per the other comments, what you are being told is wrong.
Time is only important during competitive events, where if you continously spend too much time reading cards, thinking about your play, deciding blockers or attackers (all within reason).
You can be warned for slow play on those circumstances but other than that there is really no 5 second rule.
What you need to be careful and it is covered in the rules (again, for competitive events) is communication. If your opponent casts a spell and you look at it and say "ok", it doesn't matter if you meant "ok, I'll let it resolve" or "ok, let me think about this", you only said "ok". Make sure you keep communication clear to ensure your opponent knows what you are doing and to avoid unnecessary judge calls.
There is no rule that state that you only have so much time to counter. Saying you only have limited time is kind of a mean move especially if the player being pushed for time is a new player who has no clue what the card does.