How do I check if a document is "oneside" or "twoside"?

The test is provided by the LaTeX kernel with

\newif \if@twoside     \@twosidefalse

So you can use this test. Please note that the test string uses @ so you need \makeatletter / \makeatother (See: What do \makeatletter and \makeatother do?)

Edit

There is a great answer of David explaining the how \newif command works

As mention by egreg the package \typearea which is loaded by every KOMA-Class by default provides the option twoside=semi. In this case the condition above should be extended by \if@semitwoside.

However based on your example you can redefine your environment as follows:

\makeatletter
%preamble
\if@twoside%
   %%% put the stuff for true here (twoside=true)
   \newcommand\side{stuff for twoside}
\else%
   %%% put the stuff for false here (twoside=false)
   \newcommand\side{stuff for onside}
\fi%  
\makeatother

\newenvironment{fwfigure}[1][htbp]%
 {%
   \figure[#1]
     \side 
   \endfigure%
}