Does the batter get a sacrifice if the runner on first tags and goes to second?

Yes as long as the runner advances

Assuming you mean the runner tags up on a fly ball and advances to second, it is not scored as a sacrifice, but, simply as a fly out and the batter is charged with a time at bat. If the batter bunt a ground ball, the runner would not be required to "tag up" to advance and the batter would be credited with a sacrifice. If the batter is attempting a sacrifice bunt and pops up and the runner, tags up and somehow advances to second the batter is not credited with a sacrifice.