Yes, you pretty much have to salute until acknowledged. Not acknowledging a salute is a form of dressing-down: if an officer is pissed off at you about something, he'll leave you hanging for a while while he stares at you. Sort of like a civilian executive having someone shown in to his office, but not bothering to look up from his desk and whatever paperwork he's pretending to occupy himself with for a while.
In VERY extreme cases, the officer you salute may fail to return your salute at all. In that case, once his attention leaves you entirely - for example, he turns his back on you - you may drop the salute. Not having your salute returned at all is a VERY extreme show of disrespect. It generally reflects very poorly on the officer who does it - it's acceptable to leave somebody to sweat for a few seconds while you glare at them if you're angry as hell at them about something, but you really shouldn't ever FAIL to return (or acknowledge) the salute at all. The only exception would be in wartime conditions when salutes are supposed to be suspended (to avoid giving snipers an idea who to shoot at) and the lower ranked person shouldn't have saluted in the first place.
It doesn't actually matter a bit whether the president is wearing a hat or not, because he's in civilian clothes. If you're in civvies, you don't salute. I only mention the hat because it's just another example of how VERY far from actual military protocol the president saluting anybody really is.