This was originally an Americanism that first appeared in the late 19th century. The 'smack' element suggests a sudden striking movement, of course, and the 'dab' part adds a suggestion of exactness. So, taken together, the idea is of quickness and precision "right on the spot".