Is castling still done in the openings in modern chess?
It's normally a very good idea to castle early, but 'as soon as possible' is not really a correct rule. It depends on a number of factors, including your choice of opening, and your opponent's response.

Leaving your king in the middle of the board is a bad idea. Your pieces can be pinned, you're much more vulnerable, and your rooks can become isolated, trapped on the sidelines. One exception to this rule sometimes arises if you have exchanged queens. Once this happens it is considerably harder to mount a successful direct mid-game assault on the king, and it may sometimes be reasonable in this situation to treat the king as an additional fighting piece, rather than as a delicate thing to hide away on the sidelines and protect at all costs.

There are a couple of rare openings where not castling is a valid strategy, but they are unusual. Castling does not occur, or occurs very late, in some variations of the French Defense. See for example Kramnik-Anand, 2008. Similar things can happen in the Sicilian Taimanov and the Hedgehog Defense. Sometimes giving up castling is a valid line for white, as happens for example in some variations of the King's Gambit Accepted such as the King's Bishop's Gambit, where Black checks on h4, and white plays Kf1.