The Centers for Disease Control and Prevention (CDC) recommends that all pregnant women have the hepatitis B surface antigen test. The test can show if a woman has a current hepatitis B infection. This test also may be repeated later in the pregnancy if a woman is at high risk for infection.
You can be tested for hepatitis B before getting vaccinated.
Antibody testing will show if you have an active hepatitis B infection and need treatment.
If testing shows that you are already protected against hepatitis B, you won't need to get the hepatitis B vaccine(What is a PDF document?).
It's not harmful to get the vaccine even if you already have antibodies against the virus in your blood.