I know of bc:
$> var="304" $> echo "obase=2; $var" | bc 100110000
Could it be done in shell (no external call)?
This question: Binary to hexadecimal and decimal in a shell script Asks how to convert FROM binary, not TO a binary number.
The answers there deal either with binary byte (as opposed to binary number, i.e.: a base-2 number) using xxd, or some other external tool. So, no, this question is not a duplicate of that.