If you use wireless headphones, please read this article.
Check that the microphone is enabled in your game session.
In the browser: exit full-screen mode and turn the toggle on (move it to the right):

You can also change the input device your browser uses in its settings. For example, in Google Chrome you can open the microphone settings directly at
chrome://settings/content/microphone, or go to Settings → Privacy and security → Site settings → Microphone.
In the desktop app: open the menu by pressing Ctrl + F2 (Windows and Linux) or holding Esc (macOS). Make sure the microphone icon is not crossed out and that the volume and sensitivity are not set to 0:

You can also test the input device in the app settings.

In a mobile browser: turn your phone to portrait mode and make sure the microphone icon is not crossed out:
Other ways to fix the problem:
Open the Steam settings (click Steam in the upper-left corner and select Settings);

Select Voice on the left;

Make sure Default or MIC 2 is selected as the input device;

Scroll down and click Show to open Advanced Options;

Try turning off Echo Cancellation or Noise Cancellation.
