You're looking for the squash feature of an interactive rebase:
Use git rebase -i HEAD~2 to start an interactive rebase.
In the opening editor, all commits that are part of the rebase are listed. In this case, since we provided the HEAD~2 argument to the rebase call, we see two commits, each prefixed by pick.
Not changing anything would lead rebase to pick, i.e. apply both commits, and nothing would be different.
Instead, what you want to do is to pick only the first commit, while squashing (use commit, but meld into previous commit) the second one. This way, you squash the second commit into the first one, resulting in a single commit.
When you safe and exit now, git will prompt you for a new commit message, and voilà: a new commit containing changes from both of the older commits.
See "Squashing commits with rebase" for detailed instructions.
As always when messing with history (as squashing different commits into a new one definitely is), you should only perform such operations on commits that you are sure nobody else based their work on.