You could achieve ''
on an autocmd using the following:
:call setpos('.', getpos("''"))
Check :help function-list
for built-in functionality on VimL.
Edit
okay, how to combine it with search and replace? Another autocmd after the search and replace one?
Vim documentation is very comprehensive and well-written, you should definitively try reading it.
If you are going to write autocmds themthen :help cmd-lines
is a must read:
autocmd BufWritePre * %s/\v^\s+$//e | call setpos('.', getpos("''"))
You should also consider using autocmd groups, as explained in :help autocmd-groups
.