There are probably a couple ways to do this, but here is a really easy one:
ob_start(); the_content(); $content = ob_get_clean();
This is called “output buffering” where the output is redirected from being directly sent out to being written to a buffer.
In case you need to do any manipulation or calculation of the content before outputting it. Admittedly, it’s probably not a very common need.
For example, on a recent redesign of my site Quotes on Design, I wanted to count the number of words in a quote so I could set the font-size based on that.
$numWords = sizeof(explode(" ", $content));
There are things you could do with this that are probably best done in other ways. For example, maybe you want to remove the paragraph tags that WordPress likes to append to content automatically for you. You’d be better off removing that filter (from your functions.php file) than messing with this.