You can cast variables in bash and ksh (use `declare -i var` or `typeset -i var` for interger), but I don't think that is your problem.
The following will set `var1` to nothing while then running the command as normal.
var1= free -m |awk 'NR == 2'| awk '{print $3}'
If you want the output of free and awk to be set to var1 then the above should read:
var1=$( free -m |awk 'NR == 2'| awk '{print $3}' )